Repository navigation
perf(showcase-dashboard): yield during fetch + parallelize initial pages - #4504
Merged
Merged
Conversation
Follow-up to the matrix memoization PR. The initial dashboard load still freezes for a few seconds because (a) the initial PB fetch is 10 sequential getList round-trips before any data arrives, and (b) when it does arrive, the empty-map → populated-map transition forces every cell in the matrix to re-render in one synchronous commit. - Parallelize initial fetch: pull page 1 sequentially to learn totalItems, then fire pages 2..N concurrently via Promise.all. Wall time drops from `sum(rtt_per_page)` to roughly `max(rtt_per_page)` modulo network parallelism. PocketBase reads are independent so this is safe. - Wrap initial setRows in startTransition. The first commit with real data is unavoidably a full-matrix re-render (per-key memo checks invalidate on every cell when the map flips from empty to populated); marking it as a transition lets React 19 yield to user input mid-walk instead of blocking the main thread for the duration. setStatus stays urgent so the "connecting → live" indicator still flips immediately. - Wrap the SSE flush setRows in startTransition for the same reason — bursts that the 16ms coalescer can't fully absorb still need to yield.
AlemTuzlak
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
April 30, 2026 15:19
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
jpr5
added a commit
that referenced
this pull request
Apr 30, 2026
Reverts #4504. The parallelized fetch change broke the dashboard's live status connection, causing all integrations to show 'offline' and the Feature Matrix to show 'OFFLINE'.
pull Bot
pushed a commit
to TheRakeshPurohit/CopilotKit
that referenced
this pull request
Apr 30, 2026
…itial pages (CopilotKit#4504)" This reverts commit d17ea91, reversing changes made to a0770ea.
jpr5
added a commit
that referenced
this pull request
Jul 24, 2026
…ake servers PR #6156 silently invalidated the dropped-tail pagination guards added by PR #4504. Regression in test COVERAGE, not production code — which is why CI stayed green. The three fake PB servers in the autocancel suite ignored the `filter` query param (and `fields`). #6156 made the supplemental `signal` fetch UNCONDITIONAL (dropping the `commAggregateFilter === null` early return and widening the filter to `state != "green"`), so a filter-ignoring server answered that now-always-issued fetch with the ENTIRE dataset — and `fetchInitial`'s leftover-append then REPAIRED whatever rows the bulk pagination dropped. Mutating the merge to drop the entire short page kept all three tests GREEN. The servers now answer a list request the way real PocketBase does: filter, then sort, then the page slice, then the `fields` projection, with the COUNT(*) envelope omitted only when `skipTotal` is set. The filter evaluator covers exactly the grammar `useLiveStatus` emits and THROWS on anything else (answered as 400) — a silently-unparsed clause would degrade to "match everything", i.e. straight back into the masking bug. Real-SDK quoting is matched (single-quoted string params, bare numbers/booleans, verified against the installed SDK); the sibling suite's double-quoting `pb.filter` stub flaw is deliberately NOT copied forward, and a wire assertion pins the convention. The supplemental fetch is discriminated by the ABSENCE of a `fields` projection — the sibling `useLiveStatus.test.tsx` convention, reused rather than reinvented. This replaces a `filter.includes("state !=")` substring check that the union filter had already made unreliable. Broken assertions repaired: - over-fetch instrumentation no longer conflates the supplemental serial walk with the bulk fan-out (separate page arrays), and the split is now asserted rather than assumed - the FIRST-wave-element server serves POISON rows on the page after the short page. Real PB pagination is monotonic, so that page is empty and appending it changes nothing — which is exactly why deleting the merge's boundary logic left the test green. Poison makes a merge that runs past the boundary observable - `.some(r => r.id === "f0699")` replaced with `rows.at(-1)?.id`, the LAST-row boundary check the comment already claimed, plus explicit poison-absence - the mid-wave suite no longer claims a boundary property its fixture cannot measure (its short page is the wave's last element); name and comment now state what it does measure, and it gained a real tail-boundary assertion Mutation red-green, both directions. Drop-the-entire-short-page: PASSED 3/3 before, now FAILS 3/3 (1300 to 1000, 1250 to 1000, 700 to 500). Boundary-logic-removed: PASSED before, now FAILS on the suite that claims it (700 to 1000). Reversed-merge-order (same row set): PASSED before, now FAILS on both new `.at(-1)` assertions. Mutations reverted: 3/3 pass. Test-only change — no production code touched.
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…ges (CopilotKit#4504) ## Summary Follow-up to CopilotKit#4502. With matrix cells memoized and SSE deltas coalesced, the dashboard is much smoother — but the **initial dashboard load** still freezes for a few seconds because: 1. **Initial PB fetch is 10 sequential round-trips.** `fetchInitial` walks `getList(page=1, 200) → getList(page=2, 200) → …` up to 10 pages, each awaiting the previous. Network wall time stacks. 2. **First commit with real data is unavoidably a full-matrix re-render.** The empty-map → populated-map transition invalidates per-key memo checks on every cell — that's 720 cell renders in one synchronous React commit, blocking the main thread. ## Changes - **Parallelize the initial fetch.** Pull page 1 sequentially to learn `totalItems`, then fire pages 2..N concurrently via `Promise.all`. Wall time drops from `sum(rtt_per_page)` to roughly `max(rtt_per_page)` modulo network parallelism. PocketBase reads are independent so this is safe. - **`startTransition` around the initial `setRows(initial)`.** The first big commit is unavoidable, but marking it as a transition lets React 19 yield to user input mid-walk instead of blocking for the entire render. `setStatus` stays urgent so the "connecting → live" indicator still flips immediately. - **`startTransition` around the SSE flush.** Bursts that the 16ms coalescer can't fully absorb (large reconnect replays, simultaneous probe completions) still need to yield rather than block. ## Test plan - [x] `useLiveStatus.test.tsx` 15/15 pass with parallelized fetch (the mock handles arbitrary page numbers). - [x] `composed-cell.test.tsx` 9/10 pass (1 pre-existing failure, same as CopilotKit#4502). - [x] No new TypeScript errors in `useLiveStatus.ts`. - [ ] **Manual perf trace before/after on the live dashboard.** Expected: initial-load wall time drops sharply (sequential → parallel pages), and any remaining heavy commit no longer blocks the main thread (transition lets React yield). - [ ] **Functional sanity** — confirm rows still arrive correctly when pages return out of order, and the "connecting → live" status transition still fires before the heavy render.
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…itial pages (CopilotKit#4504)" This reverts commit d17ea91, reversing changes made to a0770ea.
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
Reverts CopilotKit#4504. The parallelized fetch change broke the dashboard's live status connection, causing all integrations to show 'offline' and the Feature Matrix to show 'OFFLINE'.
This branch was successfully deployed
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
Follow-up to #4502. With matrix cells memoized and SSE deltas coalesced, the dashboard is much smoother — but the initial dashboard load still freezes for a few seconds because:
fetchInitialwalksgetList(page=1, 200) → getList(page=2, 200) → …up to 10 pages, each awaiting the previous. Network wall time stacks.Changes
totalItems, then fire pages 2..N concurrently viaPromise.all. Wall time drops fromsum(rtt_per_page)to roughlymax(rtt_per_page)modulo network parallelism. PocketBase reads are independent so this is safe.startTransitionaround the initialsetRows(initial). The first big commit is unavoidable, but marking it as a transition lets React 19 yield to user input mid-walk instead of blocking for the entire render.setStatusstays urgent so the "connecting → live" indicator still flips immediately.startTransitionaround the SSE flush. Bursts that the 16ms coalescer can't fully absorb (large reconnect replays, simultaneous probe completions) still need to yield rather than block.Test plan
useLiveStatus.test.tsx15/15 pass with parallelized fetch (the mock handles arbitrary page numbers).composed-cell.test.tsx9/10 pass (1 pre-existing failure, same as perf(showcase-dashboard): memoize matrix cells + coalesce SSE deltas #4502).useLiveStatus.ts.