fix(mobile): hold stored sessions across blank refetch - #5411
Merged
Conversation
reconcileFirstPage empties the stored-list cache before refetching page one on session departure and mutation settle. Keep rendering the last non-empty rows for the same query key until the refetch delivers, so the Agents list never flashes its empty state and the SectionList never unmounts (which reset scroll to the top).
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 200.7K · Output: 19.4K · Cached: 382.8K Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Agents tab session list no longer flashes an empty "No sessions yet" or "No past sessions" message during a background refresh.
The session list keeps its scroll position when a live session ends or when a rename, delete, or create settles.
The stored session list now renders the last non-empty rows while
reconcileFirstPageblanks the cache and refetches page one. The newresolveStoredSessionsHoldcontract andStoredSessionsHoldtype decide the render from the live rows, the fetch state, and the previous hold, scoped to the JSON-encoded infinite query key, so a filter or sort change still shows its skeleton instead of the previous filter's rows. The hold releases when the refetch settles with rows or with an empty result.Files
apps/mobile/src/lib/agent-session-render-hold.ts— adds theStoredSessionsHoldtype and the pureresolveStoredSessionsHoldhelper.apps/mobile/src/lib/hooks/use-agent-sessions.ts— computes the JSON query key, feeds the live rows and fetch state into the helper, stores the hold in a ref, and renders the resolved rows for date grouping and the returnedstoredSessions.Tests: 2 files —
apps/mobile/src/lib/agent-session-render-hold.test.ts(new) andapps/mobile/src/lib/query/infinite-retention.test.ts(updated).Generated: none.
Visual Changes
Agents tab session list (iOS). When a live session ends, the list keeps its history rows and scroll position, and no empty state appears. The clipped row under the TODAY header and the 22:41 history rows below it show the kept scroll position.
Verification
Two cases ran on iOS.
The rounds reproduced no defect on an unfixed build; the fix was already in place, so no unfixed-build repro ran.
Recordings:
/private/var/folders/pz/_kmbp8vs2755j415slh2hz100000gn/T/kilo-workflow-agents-list-stability-53a1.xPYOqS/e2e-verify-r1-BQRXsC/s1-blanking-refetch.mp4and/private/var/folders/pz/_kmbp8vs2755j415slh2hz100000gn/T/kilo-workflow-agents-list-stability-53a1.xPYOqS/e2e-verify-r2-ANxpxY/s2-scroll-live-dead.mp4.Reviewer Notes
No human steps are needed.