feat(frontend/copilot): paginate session sidebar so threads past 50 stay reachable - #13128
Conversation
… reachable
The session sidebar called `useGetV2ListSessions({ limit: 50 })` once and
never asked for more, so users with more than 50 chats lost access to
every older thread via the UI even though the backend already supported
`offset` + returned a `total`. Switch the sidebar and mobile drawer to a
shared `useInfiniteQuery`-backed `useSessionList` hook, add a "Load older
chats" affordance, and reroute existing session-list invalidations
(title poll, delete, create, cross-tab sync, rename) to the new key so
they refresh every loaded page.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
WalkthroughAdds a paginated session-list hook ( ChangesSession list pagination and consumption
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
🔍 PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. 🔴 Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
Summary: 1 conflict(s), 0 medium risk, 0 low risk (out of 1 PRs with file overlap) Auto-generated on push. Ignores: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #13128 +/- ##
==========================================
- Coverage 71.41% 71.37% -0.04%
==========================================
Files 2210 2211 +1
Lines 166745 166761 +16
Branches 17015 17019 +4
==========================================
- Hits 119075 119032 -43
- Misses 44128 44172 +44
- Partials 3542 3557 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…face Adds three integration tests in ChatSidebar.test.tsx that pin the new pagination wiring: - "Load older chats" hides when total === loaded - button renders when total > loaded - clicking advances the offset (read from the request) and hides the button once the final page resolves Also drops the unused getV2ListSessionsResponse re-export, the unused total field on the hook return, and the now-orphaned getTotal helper. Documents the refetchInterval refetches-all-pages trade-off inline since TanStack Query v5 removed refetchPage and the worst case is bounded by the user's session count. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
older-chats.mov |
|
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
…sion list) Combine paginated session-list hook with the new chat-search UX that landed on dev: - ChatSidebar: keep both the `useSessionList` import + invalidation key and the new `ChatSearchModal` + Cmd/Ctrl-K keyboard shortcut effect. - MobileDrawer: route `useChatSearch` through the paginated `sessions` array from `useSessionList` instead of the legacy single-page response. - ChatSidebar tests: keep both the MSW `http` helpers added for pagination tests and the `userEvent` import added for the search flow. Note: chat search now only scans loaded pages — older sessions become searchable as the user clicks "Load older chats". Acceptable trade-off for this round; a server-side search hookup is a follow-up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
…tay reachable (Significant-Gravitas#13128) ### Why / What / How **Why.** The CoPilot session sidebar fetched only the first 50 sessions and stopped. Any user with more than 50 chats lost access to every older thread through the UI even though the backend already supported `offset` and returned a `total` count. Threads weren't lost in the DB — they were just invisible. **What.** Wire proper pagination into the sidebar and mobile drawer with a "Load older chats" affordance, backed by a single shared infinite-query hook. Reroute all session-list cache invalidations so they refresh every loaded page, not just page 1. **How.** - New `useSessionList` hook wraps `useInfiniteQuery` around the existing `getV2ListSessions` fetcher: page size 50, `offset` pageParam, `refetchInterval` 10s, `getNextPageParam` derived from `total`. - Hook lives on a fresh `SESSION_LIST_QUERY_KEY` so the infinite cache doesn't collide with the orval-generated single-query key shape (which would break shape-sensitive cache readers). - `ChatSidebar` and `MobileDrawer` consume the hook and render a ghost `Button` with `loading` state at the end of the list when `hasMore`. - `useSessionTitlePoll` walks `InfiniteData` pages via a small `flattenSessions` helper instead of reading the legacy single-page response. - Five invalidation callsites (`useChatSession`, `useCopilotNotifications`, `useSessionDeletion`, `useSessionTitlePoll`, `ChatSidebar`) updated to invalidate the new key, so create/delete/rename/cross-tab-sync still refresh the sidebar correctly. ### Changes 🏗️ - Add `frontend/src/app/(platform)/copilot/useSessionList.ts` (shared paginated hook + `SESSION_LIST_QUERY_KEY` + `flattenSessions` cache walker). - `ChatSidebar.tsx`: replace single-page `useGetV2ListSessions` with `useSessionList`, add Load-more button, point invalidations at the new key. - `MobileDrawer.tsx`: mirror the same paginated fetch + Load-more affordance. - `useSessionTitlePoll.ts`: walk infinite-cache pages; invalidate the new key. - `useChatSession.ts`, `useCopilotNotifications.ts`, `useSessionDeletion.ts`: switch invalidation calls to `SESSION_LIST_QUERY_KEY`. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [ ] I have tested my changes according to the test plan: - [x] `pnpm types` — clean - [x] `pnpm lint` — clean (only pre-existing img-tag warnings) - [x] `pnpm test:unit src/app/(platform)/copilot` — 59 files / 929 tests pass, including the existing `ChatSidebar` delete + status-indicator suites against the new wiring - [ ] Manual: seed a user with >50 sessions; confirm "Load older chats" appears, paginates correctly, and that the button disappears when `loaded === total` - [ ] Manual: confirm the 10s refetch still surfaces running/queued/processing indicators on all loaded pages - [ ] Manual: delete / rename / create-new-session — confirm the sidebar refreshes - [ ] Manual: cross-tab `localStorage` storage event still invalidates the list - [ ] Manual: title-poll still animates the new title in after stream completion --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
## AutoPilot Scheduling, New Design & Out of Beta Changelog covering platform versions `v0.6.59` through `v0.6.63` (May 7 – June 10, 2026). ### Featured sections - **AutoPilot major upgrades** — native scheduling (#13190), self-distilled skills registry (#13195), message queuing (#12841) - **New login & signup** — animated panel, aurora, integrations marquee (#13169) - **Subscriptions out of beta** — plans & payments fully live (#12935) - **Settings rebuilt + profile dropdown** — cleaner layout, integrations tab, quick-action menu (#13138, #12976) ### Improvements listed (not featured) - Trigger On Anything (#12740) - Export Chat as Markdown (#13070) - Auto-open artifact panel (#12997) - Slack block (#13008) - Cost breakdown in briefing panel (#13129) - Session sidebar pagination (#13128) - Faster first response in AutoPilot (#12828) ### Files changed - `docs/platform/changelog/may-7-june-10-2026.md` — new changelog page - `docs/platform/.gitbook/assets/` — 5 new hero images - `docs/platform/SUMMARY.md` — new entry at top - `docs/platform/changelog/README.md` — new row at top of table
Why / What / How
Why. The CoPilot session sidebar fetched only the first 50 sessions and stopped. Any user with more than 50 chats lost access to every older thread through the UI even though the backend already supported
offsetand returned atotalcount. Threads weren't lost in the DB — they were just invisible.What. Wire proper pagination into the sidebar and mobile drawer with a "Load older chats" affordance, backed by a single shared infinite-query hook. Reroute all session-list cache invalidations so they refresh every loaded page, not just page 1.
How.
useSessionListhook wrapsuseInfiniteQueryaround the existinggetV2ListSessionsfetcher: page size 50,offsetpageParam,refetchInterval10s,getNextPageParamderived fromtotal.SESSION_LIST_QUERY_KEYso the infinite cache doesn't collide with the orval-generated single-query key shape (which would break shape-sensitive cache readers).ChatSidebarandMobileDrawerconsume the hook and render a ghostButtonwithloadingstate at the end of the list whenhasMore.useSessionTitlePollwalksInfiniteDatapages via a smallflattenSessionshelper instead of reading the legacy single-page response.useChatSession,useCopilotNotifications,useSessionDeletion,useSessionTitlePoll,ChatSidebar) updated to invalidate the new key, so create/delete/rename/cross-tab-sync still refresh the sidebar correctly.Changes 🏗️
frontend/src/app/(platform)/copilot/useSessionList.ts(shared paginated hook +SESSION_LIST_QUERY_KEY+flattenSessionscache walker).ChatSidebar.tsx: replace single-pageuseGetV2ListSessionswithuseSessionList, add Load-more button, point invalidations at the new key.MobileDrawer.tsx: mirror the same paginated fetch + Load-more affordance.useSessionTitlePoll.ts: walk infinite-cache pages; invalidate the new key.useChatSession.ts,useCopilotNotifications.ts,useSessionDeletion.ts: switch invalidation calls toSESSION_LIST_QUERY_KEY.Checklist 📋
For code changes:
pnpm types— cleanpnpm lint— clean (only pre-existing img-tag warnings)pnpm test:unit src/app/(platform)/copilot— 59 files / 929 tests pass, including the existingChatSidebardelete + status-indicator suites against the new wiringloaded === totallocalStoragestorage event still invalidates the list