Skip to content

fix(toasts): load the star toast chunk before showing it so hover stays still - #51913

Merged
nwparker merged 1 commit into
stablyai:mainfrom
gomezacero:fix/onboarding-star-toast-hover-flicker
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
gomezacero:fix/onboarding-star-toast-hover-flicker

Conversation

@gomezacero

@gomezacero gomezacero commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you hovered the "Onboarding completed! / Star on GitHub" popup, it jumped up and down, so its buttons were hard to click. The popup was measured before its contents had loaded, so it was recorded as zero pixels tall and that wrong size was never corrected. Now the contents load first and the popup appears after, so it gets the right size and stays still when you hover.

What Changed

  • Before: hovering the onboarding star toast made it jump between its normal spot and a spot below the status bar on almost every frame. "Star on GitHub" and "Later" could not be clicked reliably.
  • After: the toast stays put on hover and both buttons work.
  • Mechanism: StarNagToastHost loads the lazy StarNagToast chunk with createSharedChunkLoad first, then calls toast.custom with the loaded component. It no longer renders the toast inside <Suspense fallback={null}>. If a hide, a newer show or an unmount arrives while the chunk is loading, the pending show is dropped, so two quick shows produce one toast.
  • shared-chunk-load.ts and its test moved unchanged (100% rename) from components/native-chat-recovery/toast/ to app-shell/startup/, next to lazy-with-retry, because two features use it now. The import in NativeChatResumeToastHost is updated.

Why

Sonner (2.0.7) measures a custom toast's height once, on its first render. #50945 made StarNagToast lazy, so the first render was the null Suspense fallback and Sonner recorded --initial-height: 0px. On hover, Sonner pins the expanded card to that height, which made the card drop and flicker. #51229 fixed the same bug for the resume report by loading the chunk before issuing the toast. This PR reuses that loader. The chunk stays lazy, so the startup gain from #50945 is kept. A static import would also fix the bug but would give that gain back.

Linked Issue

Fixes #51912

Visual Proof

Taken from a headless component fixture that renders the real StarNagToastHost, StarNagToast and the app Toaster, with a stubbed window.api.starNag, while the pointer hovers the toast. These are not screenshots of the packaged app.

Before (main): the hovered card is pinned to a 0px height and drops below its anchor. Only the header row is visible.

Before: hovered star toast collapsed below its anchor

After (this PR): the hovered card keeps its full height and stays in place.

After: hovered star toast stays in place with both buttons visible

Sonner --initial-height Max card shift while hovering "Later" clickable
main 0px 144px No (Playwright "element is not stable")
this PR 144px 0px Yes, and it sends only the later IPC call

Testing

  • Reproduced in a headless Chromium component fixture with real-pointer hover, sampling the card's position every animation frame. On main the card shifted 144px and expand/collapse toggled on most frames. With the fix: 0px shift and one toggle. "Later" and the close button each send exactly one IPC call.

  • Race cases in the same fixture: two shows before the chunk loads give one toast (the newer one) and no dismiss IPC. A show followed by a hide before the chunk loads gives no toast and no IPC.

  • The existing tests/component-fixtures/resume-toast-hover.spec.ts passes 6/6 after the move.

  • vitest on shared-chunk-load.test.ts and lazy-with-retry.test.ts: 5/5 pass.

  • On the touched files: oxlint, oxfmt, anti-slop oxlint, native code-quality oxlint, ast-grep and check-changed-code-quality.mjs are all clean. Targeted typecheck is clean.

  • Platforms: the contributor tested on Windows 11. The fixture was also run headless on macOS. This is renderer-only code with no platform-specific logic.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

No new automated test. The existing shared-chunk-load test only moved with its module. The hover behavior was checked with a throwaway headless fixture (results above). Component-fixture specs don't run in CI, and resume-toast-hover.spec.ts already covers the same load-before-issue pattern.

Performance

None, because star-nag:show fires at most once per prompt and only one host is mounted. The chunk is still fetched lazily, only when the toast is requested. The only change is that the toast waits for the fetch instead of rendering an empty shell first. Measured with the real createSharedChunkLoad path: a show with the chunk cached takes p50 0.2us and p99 1.0us per request plus await. 200 rapid shows before the chunk resolves take 0.139 ms of sync work in total, call the factory once and issue one toast. At N=200 tabs, panes or worktrees there is still one handler call and one chunk request per show, the same as main. No store, selector or memo changes, no sync I/O, no polling and no new startup bytes (shared-chunk-load was already in the startup bundle). The per-frame relayout loop on hover is gone.

Risk

The riskiest part is the short gap between main's star-nag:show and the toast being issued. A hide, a newer show or an unmount in that gap cancels the pending toast, which is the intended behavior. On first show the toast appears after its local chunk loads (a few ms) instead of as an empty 0px shell.

Known limitation, unchanged by this PR: main counts the prompt as shown when it sends the event. If the chunk fails to load, no toast appears (a warning is logged, and lazy-chunk reload recovery still applies while the request is waiting).

Renderer only. No changes to saved data, settings, IPC, SSH or mobile. A plain revert backs it out.

Level: Low

Review

  • Cross-platform: platform-independent renderer code.
  • SSH/remote, agents, integrations: not touched.
  • Security: no new IPC, network access or input handling.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Follow-up, out of scope: src/renderer/src/components/plugins/dialogs/PluginUpdateReviewHost.tsx still renders a lazy PluginUpdateReviewToast inside <Suspense fallback={null}> within toast.custom, so it probably has the same 0px first-measure bug. It should get the same fix in a separate PR.

Original fix by @gomezacero in #51913.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The native chat recovery host now imports createSharedChunkLoad from the app-shell startup module. The star-nag host loads its toast chunk before creating the toast. It skips creation for inactive requests, releases pending requests when dismissed, and logs load failures. Existing toast callbacks and dismissal options remain in place.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 07b84

This fixes the star toast jumping on hover by loading its content before the toast is created. I found no concrete merge-blocking risk. Stale or abandoned loads do not create toasts, and the chunk stays lazy.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Directly linked issue #51912 reports that the "Onboarding completed!" toast flickers on hover because Sonner measures it at 0px while its lazy body sits inside Suspense fallback={null}. At the current…
Out of Scope Changes check Passed The whole-PR summary lists changes only in StarNagToastHost.tsx (the fix), NativeChatResumeToastHost.tsx (one-line import update), and the rename of shared-chunk-load.ts and its test to src/renderer/s…
Title check Passed The title names the main change: the star toast chunk is loaded before the toast is shown, which keeps the hover state stable. It also cites the fix type and the user-visible result. It is short and s…
Description check Passed The description follows the repository template and covers all required sections: ELI5, What Changed, Why, Linked Issue (Fixes #51912), Visual Proof with before/after images, Testing, Performance, Ris…
Full details: Linked Issues check

Explanation

Directly linked issue #51912 reports that the "Onboarding completed!" toast flickers on hover because Sonner measures it at 0px while its lazy body sits inside Suspense fallback={null}. At the current head, StarNagToastHost.tsx loads the StarNagToast chunk through createSharedChunkLoad before calling toast.custom. It renders the resolved component directly with no Suspense, so Sonner measures the real content. The import() call stays inside the loader, so the chunk remains lazy. A hide, a newer show, or an unmount releases the pending request, and the pendingRequest !== request check drops stale resolutions. The incremental diff since the previous reviewed head (6e933db) could not be read, and the previous file blob is unavailable, so I could not isolate what changed in this step. The head file still matches the mechanism assessed previously. The runtime result rests on the author's headless fixture evidence, which I did not re-run.

Full details: Out of Scope Changes check

Explanation

The whole-PR summary lists changes only in StarNagToastHost.tsx (the fix), NativeChatResumeToastHost.tsx (one-line import update), and the rename of shared-chunk-load.ts and its test to src/renderer/src/app-shell/startup/ with unchanged content. The move supports two features and is a supporting refactor for #51912. The head StarNagToastHost.tsx contains no unrelated behavior. The incremental diff since the previous reviewed head could not be read, so I cannot rule out an unrelated change in that increment. No such change appears in the whole-PR summary or the PR description.

Full details: Title check

Explanation

The title names the main change: the star toast chunk is loaded before the toast is shown, which keeps the hover state stable. It also cites the fix type and the user-visible result. It is short and specific and matches the changeset (StarNagToastHost using createSharedChunkLoad, plus the moved shared-chunk-load module).

Full details: Description check

Explanation

The description follows the repository template and covers all required sections: ELI5, What Changed, Why, Linked Issue (Fixes #51912), Visual Proof with before/after images, Testing, Performance, Risk with level, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It explains the mechanism (chunk preloaded via createSharedChunkLoad, Suspense removed, pending show canceled on hide/newer show/unmount) and the rationale against a static import. The Visual Proof section gives before/after images in a fixture rather than the packaged app, and the stated limitation is disclosed. Some checklist items remain unchecked (automated tests, and lint/typecheck/test/build), and the new-test box is unchecked with an explanation given. The AI Disclosure section is blank, which is acceptable for a maintainer. Overall the description is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 121315b5-1409-45d7-b24a-5f7c7ae0a951
Commits

Reviewing files that changed from the base of the PR and between 6e933db and 07b8420.

Files selected for processing: 3

  • src/renderer/src/app-shell/startup/shared-chunk-load.test.ts
  • src/renderer/src/app-shell/startup/shared-chunk-load.ts
  • src/renderer/src/components/star-nag/StarNagToastHost.tsx
Files with no reviewable changes: 2

  • src/renderer/src/app-shell/startup/shared-chunk-load.test.ts
  • src/renderer/src/app-shell/startup/shared-chunk-load.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

…ys still

StarNagToastHost rendered the lazy StarNagToast inside
<Suspense fallback={null}> within toast.custom. Sonner measures a custom
toast's height on its first render, so it recorded 0px and pinned the
hovered card to that height, making the toast jump and its buttons hard
to click.

Load the chunk with createSharedChunkLoad before calling toast.custom,
as stablyai#51229 did for the resume report. A hide, a newer show or an unmount
while the chunk is loading abandons the pending show. Move
shared-chunk-load next to lazy-with-retry now that two features use it.

Fixes stablyai#51912

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/onboarding-star-toast-hover-flicker branch from 6e933db to 07b8420 Compare November 28, 2026 19:04
@nwparker nwparker changed the title fix(toasts): keep the onboarding star toast still on hover fix(toasts): load the star toast chunk before showing it so hover stays still Nov 28, 2026
@nwparker
nwparker merged commit 4859899 into stablyai:main Nov 28, 2026
55 of 56 checks passed
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.

[Bug]: "Onboarding completed!" toast flickers nonstop on hover and its buttons cannot be clicked

2 participants