Skip to content

feat(conversation): prototype infinite-query pagination for classic history - #568

Open
RonenMars wants to merge 2 commits into
mainfrom
feat/conversations-infinite-query
Open

feat(conversation): prototype infinite-query pagination for classic history#568
RonenMars wants to merge 2 commits into
mainfrom
feat/conversations-infinite-query

Conversation

@RonenMars

Copy link
Copy Markdown
Owner

Implements step 1 of ADR 0001 (added in this PR: docs/adr/0001-hub-data-layer-lazy-pagination.md).

Why

The Hub eager-drains every page of every server up front (useEagerConversations), which is the source of the progress churn and the "syncing" re-render loop that #563 / #566 pace and guard.
The finest fix is to not drain — paginate lazily.
The infrastructure already exists but was never wired: useConversations is a useInfiniteQuery with no callers, and ConversationList already supports onEndReached / hasNextPage / isFetchingNextPage.

What this prototype does

  • Feeds the Classic History ConversationList from the infinite useConversations with a real onEndReachedfetchNextPage, replacing the eager-drained array and the stubbed pagination props (onEndReached={() => {}}, isFetchingNextPage={false}).
  • Adds an { enabled } option to useConversations so it only fetches when the History tab is visible.
  • Adds a module-level EMPTY_CONVERSATIONS stable reference so the list doesn't see a fresh [] each render while the query is disabled or loading.

Scope / caveats (it's a prototype)

  • The eager path still backs the tree/hub/classic-sessions surfaces, so the eager and infinite hooks coexist for now — the documented interim state in the ADR, not the destination.
  • On-device verification (scroll-to-load, render-count check with the documented probes) is a follow-up; this PR is compile/lint/type-clean but not yet measured on device.
  • Migrating the remaining surfaces off the eager drain, the conversation cache-patch, and colocating status/progress subscriptions are the later ADR steps.

Verification

ESLint clean on the changed files; tsc reports no new errors (the repo-wide router.push typed-routes errors are pre-existing).
The useConversations signature change is backward-compatible (new optional 3rd arg), so existing behavior is unchanged.

…istory

First concrete step of ADR 0001 (Hub data layer: lazy pagination over eager multi-server drain).
The Classic History ConversationList is now fed by the already-existing infinite useConversations hook with a real onEndReached -> fetchNextPage, instead of the eager full-drain.
useConversations gains an { enabled } option so it only fetches when that tab is visible; the eager path still backs the tree/hub/classic-sessions surfaces, so the two coexist during migration (documented interim state).
Adds a stable EMPTY_CONVERSATIONS reference so the list does not see a fresh [] each render while the query is disabled or loading.
This is a prototype: on-device verification and migrating the remaining surfaces are follow-ups per the ADR.
…lassic

Captures the per-view loading strategy (flat row-pagination for classic; group-first, expand-to-load for the directory-grouped tree/hub), the sessions-stay-eager vs conversations-go-lazy split, the open questions to resolve first, deliverables, and the on-device verification method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant