Skip to content

perf(dashboard): stop re-sending repo icon data URLs on every republish - #11089

Merged
brennanb2025 merged 6 commits into
mainfrom
brennanb2025/fix-dashboard-icon-republish
Jul 28, 2026
Merged

brennanb2025 merged 6 commits into
mainfrom
brennanb2025/fix-dashboard-icon-republish

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

What

#11012 added repo icons to the dashboard snapshot, keyed by repoId. Its own commit message notes the tradeoff:

Icons ride the snapshot keyed by repoId — image icons are data URLs, and the snapshot republishes several times a second.

That republish is the problem:

  • MAX_REPO_ICON_DATA_URL_LENGTH = 400 * 1024 (src/shared/repo-icon.ts:11) — each image icon is up to 400KB.
  • build-dashboard-snapshot.ts:196 puts an icon on the snapshot for every repo that contributes a card, rebuilt fresh each call.
  • useDashboardPopoutBridge.ts:9 — PUBLISH_THROTTLE_MS = 250, so up to 4 publishes/sec for as long as the pop-out is open.

So with image icons configured, the bridge structured-clones hundreds of KB to megabytes per second across the window boundary, re-sending bytes the pop-out already has. Icons change approximately never.

Scope of exposure: only while the dashboard pop-out is open, and only for repos with uploaded image icons — provider-derived icons are short https:// URLs, not data URLs. Real, but conditional.

Fix

Publish repoIconsByRepoId only when it actually changed. Comparison is by reference, not deep value: icons come off immutable store repo records, so an unchanged repo yields the identical object, and a rebuilt record correctly counts as changed.

The two paths where the pop-out could be starting from nothing still force a full send:

call site forced? why
setOpen(true) yes pop-out just opened
onSnapshotRequested yes pop-out mounted and asked
throttled republish (leading + trailing) no pop-out already has the map

The pop-out retains the last map it was given when the field is omitted. An explicitly empty map still clears, so removing an icon works.

Contract safety

No shared-type change: repoIconsByRepoId is already optional on DashboardSnapshot, and isDashboardRepoIcons already returns true for undefined (src/main/ipc/dashboard-payload-validation.ts:63-65), so the main-process validator accepts the omitted field as-is. Both renderer bundles ship together, so there is no cross-version skew.

The in-window path (useLiveDashboardSnapshot) builds locally and never crosses IPC — untouched.

Tests

useDashboardSnapshot.test.tsx — retains icons on an omitting republish; replaces them when a new map arrives (and an omission after that retains the new map, not the old); honours an explicitly empty map.

useDashboardPopoutBridge.test.tsx — repoIconsUnchanged unit tests: first publish always counts as changed; reference vs. structurally-equal; added/removed/swapped-same-size keys; null icons.

Mutation-checked — deleting the retention branch fails 2 of the new cases:

× retains the last repo icons when a republish omits them
× replaces retained icons when the bridge sends a new map
Tests  2 failed | 3 passed (5)

With the fix: 27 passed (27) across the bridge, pop-out, kanban board, and payload-validation suites. pnpm run tc clean.

Found by a release-readiness scan of v1.4.159..v1.4.160-rc.3.

#11012 put repo icons on the dashboard snapshot keyed by repoId. Image icons
are data URLs capped at MAX_REPO_ICON_DATA_URL_LENGTH (400KB) and every repo
contributing a card ships one, while the snapshot republishes up to 4x/sec
(PUBLISH_THROTTLE_MS = 250) for as long as the pop-out is open. Icons change
about never, so that structured-clones megabytes per second across the window
boundary for bytes the pop-out already has.

Publish the map only when it actually changed, comparing by reference since
icons come off immutable store repo records. The two paths where the pop-out
could be starting from nothing — it opened, or it mounted and asked — still
force a full send, so the retained copy can never be the only one.

The pop-out keeps the last map it was given when a republish omits the field.
An explicitly empty map still clears, so removing an icon works.

repoIconsByRepoId was already optional on DashboardSnapshot and
isDashboardRepoIcons already returns true for undefined, so the main-process
validator needed no change.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The dashboard popout bridge compares repository icon maps by reference, omits unchanged maps from throttled republishes, and forces icons into opening and requested snapshots. The IPC cache and snapshot hook retain omitted maps, while new or empty maps replace retained values. Tests cover publishing, replay, comparison, replacement, and clearing behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, but it misses required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections and include the required AI review, security audit, screenshot status, and testing checklist details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: reducing repeated repo icon data URL republishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts (1)

12-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Condense the new renderer comments.

Keep the non-obvious performance/retention rationale, but reduce these multi-line explanations to concise one-line comments; test names and assertions already convey the rest.

  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts#L12-L22: shorten the helper documentation.
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts#L105-L107: reduce the withIcons explanation.
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.test.tsx#L165-L166: remove or shorten the assertion walkthrough.
  • src/renderer/src/components/dashboard-popout/useDashboardSnapshot.ts#L42-L45: retain only the omission/retention rationale.
  • src/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsx#L100-L102: let the test name describe this behavior.

As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b2fadd8-bc01-4ef7-ab4b-c934489b09e4

📥 Commits

Reviewing files that changed from the base of the PR and between e73b1a1 and 8528e95.

📒 Files selected for processing (4)
  • src/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsx
  • src/renderer/src/components/dashboard-popout/useDashboardSnapshot.ts
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.test.tsx
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts

The bridge now omits an unchanged repoIconsByRepoId from republishes, so the
cached snapshot main replays to a mounting pop-out could be icon-less, blanking
the board's repo glyphs until the forced publish landed. Carry the last map
into the cache; the forwarded payload is unchanged.

Also covers the forced full sends (open, reopen, snapshot request) that no test
exercised.
The changed-code quality gate reports react-doctor findings that overlap
added lines, and effect-needs-cleanup spans the whole publish effect — so
this PR's edits inside it turned a pre-existing false positive into a red
static-analysis check. Hoisting the store subscriber leaves the effect
owning one disposable; behaviour is unchanged.
The effect owns four disposables (offOpenChanged, offRequested, the store
unsubscribe, and the trailing timer), not one. State the real reason the
subscribe is hoisted so nobody inlines it back and re-reds the gate.
…t is open

The lazy wiring exists so an enabled-but-closed pop-out costs nothing — a live
subscriber would rebuild a cross-worktree snapshot on unrelated store writes.
Nothing pinned the unsubscribe on close.
@brennanb2025
brennanb2025 merged commit 25da91d into main Jul 28, 2026
24 checks passed
zpyoung pushed a commit to zpyoung/orca that referenced this pull request Jul 29, 2026
…sh (stablyai#11089)

* perf(dashboard): stop re-sending repo icon data URLs on every republish

stablyai#11012 put repo icons on the dashboard snapshot keyed by repoId. Image icons
are data URLs capped at MAX_REPO_ICON_DATA_URL_LENGTH (400KB) and every repo
contributing a card ships one, while the snapshot republishes up to 4x/sec
(PUBLISH_THROTTLE_MS = 250) for as long as the pop-out is open. Icons change
about never, so that structured-clones megabytes per second across the window
boundary for bytes the pop-out already has.

Publish the map only when it actually changed, comparing by reference since
icons come off immutable store repo records. The two paths where the pop-out
could be starting from nothing — it opened, or it mounted and asked — still
force a full send, so the retained copy can never be the only one.

The pop-out keeps the last map it was given when a republish omits the field.
An explicitly empty map still clears, so removing an icon works.

repoIconsByRepoId was already optional on DashboardSnapshot and
isDashboardRepoIcons already returns true for undefined, so the main-process
validator needed no change.

* fix(dashboard): keep repo icons in the main-process snapshot cache

The bridge now omits an unchanged repoIconsByRepoId from republishes, so the
cached snapshot main replays to a mounting pop-out could be icon-less, blanking
the board's repo glyphs until the forced publish landed. Carry the last map
into the cache; the forwarded payload is unchanged.

Also covers the forced full sends (open, reopen, snapshot request) that no test
exercised.

* test(dashboard): pin the icon omit on the throttled trailing republish

* fix(dashboard): keep the popout bridge effect off the react-doctor gate

The changed-code quality gate reports react-doctor findings that overlap
added lines, and effect-needs-cleanup spans the whole publish effect — so
this PR's edits inside it turned a pre-existing false positive into a red
static-analysis check. Hoisting the store subscriber leaves the effect
owning one disposable; behaviour is unchanged.

* docs(dashboard): correct why watchSnapshotInputs sits outside the effect

The effect owns four disposables (offOpenChanged, offRequested, the store
unsubscribe, and the trailing timer), not one. State the real reason the
subscribe is hoisted so nobody inlines it back and re-reds the gate.

* test(dashboard): pin that the bridge subscribes only while the pop-out is open

The lazy wiring exists so an enabled-but-closed pop-out costs nothing — a live
subscriber would rebuild a cross-worktree snapshot on unrelated store writes.
Nothing pinned the unsubscribe on close.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…sh (stablyai#11089)

* perf(dashboard): stop re-sending repo icon data URLs on every republish

stablyai#11012 put repo icons on the dashboard snapshot keyed by repoId. Image icons
are data URLs capped at MAX_REPO_ICON_DATA_URL_LENGTH (400KB) and every repo
contributing a card ships one, while the snapshot republishes up to 4x/sec
(PUBLISH_THROTTLE_MS = 250) for as long as the pop-out is open. Icons change
about never, so that structured-clones megabytes per second across the window
boundary for bytes the pop-out already has.

Publish the map only when it actually changed, comparing by reference since
icons come off immutable store repo records. The two paths where the pop-out
could be starting from nothing — it opened, or it mounted and asked — still
force a full send, so the retained copy can never be the only one.

The pop-out keeps the last map it was given when a republish omits the field.
An explicitly empty map still clears, so removing an icon works.

repoIconsByRepoId was already optional on DashboardSnapshot and
isDashboardRepoIcons already returns true for undefined, so the main-process
validator needed no change.

* fix(dashboard): keep repo icons in the main-process snapshot cache

The bridge now omits an unchanged repoIconsByRepoId from republishes, so the
cached snapshot main replays to a mounting pop-out could be icon-less, blanking
the board's repo glyphs until the forced publish landed. Carry the last map
into the cache; the forwarded payload is unchanged.

Also covers the forced full sends (open, reopen, snapshot request) that no test
exercised.

* test(dashboard): pin the icon omit on the throttled trailing republish

* fix(dashboard): keep the popout bridge effect off the react-doctor gate

The changed-code quality gate reports react-doctor findings that overlap
added lines, and effect-needs-cleanup spans the whole publish effect — so
this PR's edits inside it turned a pre-existing false positive into a red
static-analysis check. Hoisting the store subscriber leaves the effect
owning one disposable; behaviour is unchanged.

* docs(dashboard): correct why watchSnapshotInputs sits outside the effect

The effect owns four disposables (offOpenChanged, offRequested, the store
unsubscribe, and the trailing timer), not one. State the real reason the
subscribe is hoisted so nobody inlines it back and re-reds the gate.

* test(dashboard): pin that the bridge subscribes only while the pop-out is open

The lazy wiring exists so an enabled-but-closed pop-out costs nothing — a live
subscriber would rebuild a cross-worktree snapshot on unrelated store writes.
Nothing pinned the unsubscribe on close.
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