Repository navigation
perf(mobile): memoize worktree list rows - #9889
Conversation
Co-authored-by: Orca <[email protected]>
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
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 |
Co-authored-by: Orca <[email protected]>
What
The mobile host worktree list rows (
WorktreeListRow,WorktreeAgentRow) were not memoized, so any unrelated parent re-render reconciled every visible row — noticeable on large lists / the tablet sidebar. #9857 already preserves the worktree-array identity on equal snapshots, but the rows still re-rendered because the parent did.Fix: wrap both rows in
React.memo(default shallow comparison) and stabilize the one prop that defeated it —onToggleLineageis now auseCallbackthat reads the worktree id from the row'sitem, instead of an inline per-row closure. Thenowprop stays a real prop so relative timestamps / status aging still update.ELI5
Your worktree list re-drew every single row whenever anything on the screen changed. Now each row only re-draws when its own data (status, preview, unread, agents…) actually changes.
Proof of zero regression
memocomparison — no custom comparator — so every live field (preview,unread,lastOutputAt,agents,status,now) still invalidates the row. perf(mobile): gate host polling on foreground/background #9857's snapshot equality keeps theitemreference stable only when nothing changed, so the memo bailout is safe and effective.item(snapshot-stable), primitives (now/status/repoColor/hideRepo/isReadOnly),repoIcon(state-owned map),onPress/onLongPress(stable), and the newuseCallbackonToggleLineage..ts+createElementconvention) proves an unrelated sibling render does not re-render the row, whilepreview/unread/lastOutputAt/agents/status/nowchanges do — and agent rows skip unchanged props but render for a changed agent. Full mobile suite 307 files / 2229 pass;typecheck/oxlint(index.tsx stays within its max-lines budget) /oxfmt --checkclean.Proof of perf improvement
Cuts row reconciliation on unrelated parent renders (which fire frequently on a live dashboard) — low-medium JS-thread savings that scale with list length, most visible on the tablet sidebar. The test directly asserts the row render count stays flat across an unrelated sibling update.
Made with Orca 🐋