Repository navigation
perf(mobile): stabilize session mutation callbacks to stop row re-renders - #6765
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of the new test-only commit: the shared Files Reviewed (4 files)
Previous Review Summaries (2 snapshots, latest commit 674e656)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 674e656)Status: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of the new test-only commit: the shared Files Reviewed (4 files)
Previous review (commit 8cdacd3)Status: No Issues Found | Recommendation: Merge Executive SummarySingle-file memoization refactor in Files Reviewed (1 file)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
|
bot: Fixed failing checks in 674e656. |
Fix proof
useSessionMutations returns deleteSession and renameSession as inline closures re-created on every render, but session-list-content.tsx lists both in renderItem's useCallback dependency array, so rend
Asserted value:
apps/mobile/src/lib/hooks/use-session-mutations.ts. Sense check (model): The diff wraps renameSessionAsync in useCallback with the stable [renameSessionMutationAsync] dep and binds deleteSessionAsync to the stable mutateAsync, so the returned callbacks listed in renderItem's deps no longer change identity.The scripts were proven on an earlier base, so only the head ran.
Head
b0266073993eHead log: backend-assert 01a0aa76cd02 exited 0
Fix proof
useSessionMutations returns deleteSession and renameSession as inline closures re-created on every render, but session-list-content.tsx lists both in renderItem's useCallback dependency array, so rend
Asserted value:
apps/mobile/src/lib/hooks/use-session-mutations.ts. Sense check (model): use-session-mutations.ts addsconst renameSessionAsync = useCallback(..., [renameSessionMutationAsync])and aliasesdeleteSessionAsyncfromdeleteSessionMutation.mutateAsync, wrapping the returned closures as the claim requires.The scripts were proven on an earlier base, so only the head ran.
Head
674e656afd0dHead log: backend-assert e75b8badae3d exited 0
Changelog for users
Changelog for maintainers
E2E proof
useSessionMutations returns deleteSession and renameSession as inline closures re-created on every render, but session-list-content.tsx lists both in renderItem's useCallback dependency array, so renderItem's identity changes on every list render and every visible stored row (a non-memoized heavy component) re-renders during pull, pagination and focus updates; wrap the returned functions in useCallback so the row renderer stays stable.
Code trace:
apps/mobile/src/lib/hooks/use-session-mutations.ts:2 changed in 08961922ed6ab87d484adad461e58dd28e58e9c4. Sense check (model): use-session-mutations.ts:2 now definesrenameSessionAsync = useCallback(async (...), [renameSessionMutationAsync])and binds the callbacks to the stablemutateAsync, so the returned functions no longer get a new identity each render and renderItem's dependency array stays stable.Changed lines
Owner request