perf(web): Selective SSRとQuery hydrationを再設計 - #598
Conversation
📝 WalkthroughWalkthrough主要ルートをSSR対応にし、loaderによるQuery preloadとhydration統合を追加しました。検索状態のセッション復元、検索クエリ生成、pending表示、SSR・SPA遷移のE2E検証、関連ドキュメントとユーティリティテストも更新しています。 ChangesSSR・Query hydration と検索状態復元
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/server/src/routes/sources/index.tsx (1)
47-78: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
stateもsourceData()ベースにする
loaderData().mediaSourcesがある間も、stateは生のクエリだけを見ているため、カード一覧と「読み込み中 / エラー」が同時に出る。config.tsxと同じように、sourceData() === undefinedを条件にするか、stateもマージ済みデータで組み立ててください。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server/src/routes/sources/index.tsx` around lines 47 - 78, Update the state callback in SourcesRouteContent to use the merged sourceData() value rather than raw mediaSources query data, so loader-provided media sources do not display alongside loading or error states. Make the loading/error condition depend on whether sourceData() is undefined, while preserving the existing empty-list handling.
🧹 Nitpick comments (1)
apps/server/src/routes/sources/$mediaSourceId/index.tsx (1)
38-50: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
SourceMediaRouteの isMounted ゲートがSourceMediaPage側と二重になっている
./components/source-media-page.tsxのSourceMediaPageは既に自前のcreateSignal/onMount/Showによるマウント待機とフォールバック表示を実装しています。ここで再度同じパターンで外側にゲートを追加すると、ハイドレーション後に2段階のマウント待ちが発生し、実コンテンツ表示までに不要な1ティック分の遅延が増えます。本PRが目標とする表示時間短縮と方向性が逆です。外側のゲートを外し、SourceMediaPage自身のゲート処理に委ねることを検討してください。♻️ 簡略化案
function SourceMediaRoute() { - const [isMounted, setIsMounted] = createSignal(false); - - onMount(() => { - setIsMounted(true); - }); - - return ( - <Show fallback={<SourceMediaRouteFallback />} when={isMounted()}> - {(_mounted) => <SourceMediaPage />} - </Show> - ); + return <SourceMediaPage />; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server/src/routes/sources/`$mediaSourceId/index.tsx around lines 38 - 50, Remove the redundant isMounted signal, onMount callback, and outer Show gate from SourceMediaRoute, and render SourceMediaPage directly so its existing mount handling and fallback remain solely responsible for hydration readiness.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/server/src/routes/sources/index.tsx`:
- Around line 47-78: Update the state callback in SourcesRouteContent to use the
merged sourceData() value rather than raw mediaSources query data, so
loader-provided media sources do not display alongside loading or error states.
Make the loading/error condition depend on whether sourceData() is undefined,
while preserving the existing empty-list handling.
---
Nitpick comments:
In `@apps/server/src/routes/sources/`$mediaSourceId/index.tsx:
- Around line 38-50: Remove the redundant isMounted signal, onMount callback,
and outer Show gate from SourceMediaRoute, and render SourceMediaPage directly
so its existing mount handling and fallback remain solely responsible for
hydration readiness.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 220b88bc-8913-4bd6-bbc5-a00e29a1976b
📒 Files selected for processing (29)
apps/server/src/router.tsxapps/server/src/routes/__root.tsxapps/server/src/routes/config.tsxapps/server/src/routes/manager.tsxapps/server/src/routes/search.tsxapps/server/src/routes/sources/$mediaSourceId/$mediaId/index.tsxapps/server/src/routes/sources/$mediaSourceId/index.tsxapps/server/src/routes/sources/index.tsxapps/server/src/tests/e2e/loading-recovery.spec.tsapps/server/src/tests/e2e/realtime-preservation.spec.tsapps/server/src/tests/e2e/route-reload.spec.tsapps/server/src/tests/e2e/support/test.tsapps/tauri/src/hooks/use-current-search-persistence.tsapps/tauri/src/routes/search.tsxdocs/design/web-rendering-strategy.mdpackages/core/src/utils/deep-equal.tspackages/core/tests/deep-equal.test.tspackages/ui/src/hooks/use-current-search-persistence.test.tspackages/ui/src/hooks/use-current-search-persistence.tspackages/ui/src/hooks/use-search-page.tspackages/ui/src/hooks/use-source-media-page.tspackages/ui/src/preset-manager.tsxpackages/ui/src/query-options/index.tspackages/ui/src/query-options/search-query.test.tspackages/ui/src/query-options/search-query.tspackages/ui/src/router-status.tsxpackages/ui/src/screens/source-media-screen.tsxpackages/ui/src/source-card.tsxpackages/ui/src/source-media-page.tsx
💤 Files with no reviewable changes (1)
- packages/ui/src/screens/source-media-screen.tsx
概要
Web主要routeのSelective SSRとSolid Query hydrationを再設計し、冷間F5の空本文・bootstrap race・hydrate後の重複fetchを解消します。
Fixes #594
変更内容
技術詳細
テスト
補足
monorepo全体のvp checkは変更外を含む既存ファイル多数がOxfmt未適用のためformat段階で失敗します。変更ファイルは既存のBiome規約でformat/check済みです。導入済みVite+ 0.1.24にはAGENTS記載のvp env doctorサブコマンドがありません。
Summary by CodeRabbit
新機能
バグ修正
テスト