perf(ui): v2メディア一覧の表示・スクロールを高速化 - #662
Conversation
Reduce virtualized row allocations and redundant scroll updates, coalesce layout measurements, and prioritize responsive thumbnails for fast image display. Persist element scroll positions and notify active thumbnail sources when HTTP retries are ready.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughスクロール位置保存をデバウンスし、メディアグリッドの行取得と計測を更新しました。サムネイル再試行の購読通知と非同期画像デコード指定を追加しました。 ChangesUI動作更新
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/ui/src/thumbnail-source.test.ts (1)
72-73: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
onCleanupによるリスナー解放をテストで検証してください。Line 72 で
unsubscribeを先に実行するため、Line 109 のlisteners.clear()がなくてもテストは成功します。購読解除とは別に、購読を残したままdispose()を実行し、その後の再試行でlistenerが呼ばれないことを確認してください。🤖 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 `@packages/ui/src/thumbnail-source.test.ts` around lines 72 - 73, Update the test around unsubscribe and dispose to verify onCleanup releases listeners independently of unsubscribe. Keep the subscription active when calling dispose(), then trigger a subsequent retry and assert that listener is not called; retain separate unsubscribe coverage if needed.
🤖 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.
Inline comments:
In `@packages/ui/src/source-media-grid.tsx`:
- Around line 354-357: Update SourceMediaGrid’s ResizeObserver lifecycle so the
element assigned to mediaGridRef after mount is observed as soon as it exists,
including the pending-state path. Register the current grid element from the ref
assignment or reactive tracking, and disconnect or unobserve the previous
element when the reference changes; preserve scheduleMediaGridMetrics for
subsequent size updates and virtual-row rendering.
---
Nitpick comments:
In `@packages/ui/src/thumbnail-source.test.ts`:
- Around line 72-73: Update the test around unsubscribe and dispose to verify
onCleanup releases listeners independently of unsubscribe. Keep the subscription
active when calling dispose(), then trigger a subsequent retry and assert that
listener is not called; retain separate unsubscribe coverage if needed.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c35bc4a2-3959-4882-9165-fdef8107a481
📒 Files selected for processing (5)
packages/ui/src/hooks/scroll-container.tspackages/ui/src/source-media-grid.tsxpackages/ui/src/thumbnail-image.tsxpackages/ui/src/thumbnail-source.test.tspackages/ui/src/thumbnail-source.ts
Register grid elements with ResizeObserver when refs are assigned after mount, and unobserve replaced elements so pending-state rendering keeps virtual layout metrics current.
v2メディア一覧の仮想行遅延生成、不要な更新抑制、ResizeObserver計測集約、レスポンシブWebPと画像優先度制御、サムネイルリトライ更新、スクロール位置のデバウンス保存・復元を実装しました。bun run check、UIユニットテスト、開発ギャラリーE2E 7/7で検証済みです。
Summary by CodeRabbit