perf(client): provider status pushes keep unchanged providers identical #20392
main fromrefs/pull/20392/head·merged by juliusmarminge View on GitHubEvery provider status push rebuilt serverConfig.providers from scratch, even when the only change was checkedAt. Each push gave every provider, skill list and model list a new identity, so ChatView, the timeline (through skills and providers) and the model picker re-rendered on every push while nothing visible had changed. ChatView carried two content-key state workarounds to hide this from the timeline.
The providerStatuses reducer in serverConfigProjection.ts now structurally shares the incoming payload with the previous one (reuseUnchanged). A subtree that is deep-equal to the previous one keeps the previous identity, and only providers that actually changed get new objects. ChatView drops its content-key workarounds and reads skills and providers directly.
I chose to do this on the client rather than skipping unchanged pushes on the server, because Settings and the sidebar's update pill display checkedAt, so those pushes are not redundant. Structural sharing keeps that field live and leaves the rest of each provider identical.
Tests: serverConfigProjection.test.ts covers unchanged providers keeping their identity, a changed provider getting a new one while its siblings are reused, and arrays. server.test.ts now asserts equality instead of identity.
Stack progress#
| Layer | ChatView lines | ChatView component body | Compiler on ChatView | Files held to strict compiler lint |
|---|---|---|---|---|
| main | 11,660 | 10,007 | crashes (internal error) | 0 |
| #20161 pending approvals and questions hook | 11,222 | 9,624 | crashes (internal error) | 0 |
| #20164 terminal drawer and panel file | 10,614 | 9,624 | crashes (internal error) | 0 |
| #20289 one terminal open/close hook | 10,466 | 9,481 | crashes (internal error) | 0 |
| #20292 compile-required lint list | 10,466 | 9,481 | crashes (internal error) | 2 |
| #20294 pending hook compiles | 10,466 | 9,481 | crashes (internal error) | 3 |
| #20296 /usage-limits panel hook | 10,397 | 9,416 | crashes (internal error) | 4 |
| #20304 queued-message editing hook | 10,172 | 9,200 | crashes (internal error) | 5 |
| #20308 linked pull request hook | 10,078 | 9,106 | crashes (internal error) | 6 |
| #20309 proactive panel hook | 9,950 | 8,984 | crashes (internal error) | 7 |
| #20312 agent-opened previews hook | 9,855 | 8,890 | crashes (internal error) | 8 |
| #20315 right panel close hook | 9,743 | 8,779 | crashes (internal error) | 9 |
| #20316 worktree setup hook | 9,660 | 8,695 | crashes (internal error) | 10 |
| #20321 two onSend phases split out | 9,660 | 8,613 | crashes (internal error) | 10 |
| #20340 compiler no longer crashes on ChatView | 9,647 | 8,599 | skips (32 reasons) | 10 |
| #20379 ChatView compiles | 9,616 | 8,469 | compiles | 11 |
| #20380 re-render fixes from profiling | 9,661 | 8,514 | compiles | 11 |
| → #20392 provider pushes keep identity | 9,628 | 8,481 | compiles | 11 |
| #20393 keyboard shortcuts command map | 9,340 | 8,265 | compiles | 13 |
| #20396 Sidebar compiles, no manual memos | 9,340 | 8,265 | compiles | 14 |
| #20397 ChatComposer compiles | 9,340 | 8,265 | compiles | 14 |
| #20401 project script editing hook | 9,110 | 8,049 | compiles | 15 |
| #20402 MessagesTimeline compiles | 9,110 | 8,049 | compiles | 16 |
| #20418 ChatView strict: no memos, no sync effects | 8,901 | 7,855 | compiles | 17 |
Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.
🤖 Generated with Claude Code (Claude Opus 5.5)
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
juliusmarminge added labelsmacroscope-review
Approvability#
Verdict: Approved at
170c7deMacroscope's review found this PR approvable — This is a contained client-side performance optimization that preserves provider data while reusing unchanged object identities to reduce redundant renders. Tests cover the structural-sharing behavior, and the PR does not alter defaults, schemas, security-sensitive code, or static-analysis configuration.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this0c48f62
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
⚠️ The latest CI run did not produce a thread transfer result for
71b2840.This comment will update automatically after the next completed run.