Skip to content

chore(portfolio): modernize Astro client setup - #24

Draft
sor4chi wants to merge 2 commits into
mainfrom
chore/astro-client-modernize
Draft

chore(portfolio): modernize Astro client setup#24
sor4chi wants to merge 2 commits into
mainfrom
chore/astro-client-modernize

Conversation

@sor4chi

@sor4chi sor4chi commented Jun 27, 2026

Copy link
Copy Markdown
Owner

概要

Astro 5 で使えるようになった機能に合わせ、クライアント/ハイドレーション設定を現代化する。低リスクな確実改善の第一弾。

変更点

  • ViewTransitionsClientRouter:Astro 5 でリネームされ、旧 ViewTransitions は deprecated alias。Base.astro の import と要素を更新。
  • リンク prefetch を有効化prefetch: { prefetchAll: true }):ClientRouter と組み合わせ、ブログ/works 間のナビゲーションを高速化。
  • 未使用 React 統合を削除src.tsx/React コンポーネント/client: ディレクティブは一切無く、@astrojs/react + react/react-dom/@types/react(-dom) は完全なデッドウェイトだったため除去(twitter 埋め込みは remark プラグイン側でReactではない)。

確認したこと

  • astro build 成功(37ページ)。
  • 出力 distreact チャンクが消えたこと、dist/index.htmlClientRouter(transitions)スクリプトが存在することを確認。
  • React/ViewTransitions の deprecation 警告は出ていない。

レビュー観点

  • ClientRouter 移行はビューポート遷移の挙動を変えない(同一機能のリネーム)。
  • prefetch は hover/viewport ベースのクライアント動作。重すぎる場合は defaultStrategytap 等に調整可能。

🤖 Generated with Claude Code

- Migrate ViewTransitions -> ClientRouter (renamed in Astro 5; the old
  alias is deprecated).
- Enable built-in link prefetching (prefetchAll) for snappier navigation,
  which pairs with the ClientRouter.
- Drop the unused @astrojs/react integration and react/react-dom/@types
  dependencies — there are no .tsx files, React components, or client:
  directives anywhere in src, so it was pure deadweight in the bundle and
  dependency tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying portfolio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 560ffd3
Status: ✅  Deploy successful!
Preview URL: https://ffdc5982.portfolio-monica-dev-com.pages.dev
Branch Preview URL: https://chore-astro-client-modernize.portfolio-monica-dev-com.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying slide with  Cloudflare Pages  Cloudflare Pages

Latest commit: 560ffd3
Status: ✅  Deploy successful!
Preview URL: https://f48f41b9.monica-dev-com.pages.dev
Branch Preview URL: https://chore-astro-client-modernize.monica-dev-com.pages.dev

View logs

Mark the theme-toggle button with `transition:persist` so the ClientRouter
keeps the same DOM node across navigations instead of re-rendering it. Its
click listener now survives too, so the `astro:after-swap` re-init is
removed — re-running it would stack a second listener on the persisted node
and toggle the theme twice (a silent no-op).

Verified in a preview build: the button is the same node after navigating
between pages, and a single click flips the theme exactly once.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sor4chi

sor4chi commented Jun 27, 2026

Copy link
Copy Markdown
Owner Author

追記: テーマトグルを transition:persist で永続化するコミット(560ffd3)を追加。プレビュービルドで「遷移後も同一ノード/1クリック=1回反転(二重発火なし)」を実地検証済み。Navigation は active がページ毎サーバ描画のため意図的に非永続。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant