fix(ui): let users dismiss loading toasts
Fixes the "can't close it" part of #9938.
Summary
- Patch
sonner@2.0.7so aloadingtoast gets the close button and swipe-to-dismiss, as every other toast type already does. - Add a guard test that fails if a version bump drops the patch, and a section for the patch in
patches/README.md.
Why
Our shared Toaster (packages/ui/src/components/ui/sonner.tsx) sets closeButton, but sonner ignores it for type === "loading". It hides the X and turns off swipe for that type, so toast.loading and toast.promise toasts stay until code replaces them. In #9938 a slow merge queue left several "Adding to queue…" toasts on screen with no way to close them. Sonner 2.0.8, the latest version, behaves the same way.
How
Two lines in Toast, in dist/index.js and dist/index.mjs:
const disabled = toastType === 'loading'becomesfalse. This flag blocked the swipe and the close click.- The close button no longer has the
toastType !== 'loading'condition.
Loading toasts still do not close by themselves. The X keeps the existing hover-only style from the shared Toaster.
I patched the library instead of wrapping toast.loading. A wrapper would miss toast.promise, and it would carry its icon and infinite duration into the toast.success({ id }) that later replaces the toast.
Before / after
These come from a harness, not the full app: the real @superset/ui/sonner Toaster with the desktop props (expand, dark), built against stock and patched sonner, and driven in headless Chrome over CDP with real mouse input. The harness has no Tailwind, so the Toaster's hover and close-button class rules are copied into it by hand.
Close button opacity per toast: stock = no button on any toast, even when hovered. Patched = 0 when the mouse is away, 1 only on the hovered toast. Clicking it removed that toast.


Testing
bun test apps/desktop/src/sonner-dismissable-loading-patch.test.tspasses. The strings it checks are absent from stock 2.0.7, so it fails without the patch.
Not in this PR
The other suggestions in #9938 are not done here: confirm "added to queue" without waiting for the merge, and check the queue without the stacked-PR flag.
Summary by cubic
Patches sonner@2.0.7 so loading toasts are dismissable. Sonner hides the close button and blocks swipe for type === "loading", leaving toast.loading and toast.promise toasts stuck on screen until code replaces them—a slow merge queue left "Adding to queue…" toasts with no way to close them (#9938). The patch renders the close button and enables swipe for every toast type; loading toasts still do not auto-close.
Bug Fixes
- Adds a guard test that fails if a version bump silently drops the patch, since
patchedDependenciesis keyed to an exact version. - Documents the patch and how to regenerate it after a version bump in
patches/README.md.
Summary by CodeRabbit
- New Features
- Loading toasts can now be dismissed with the close button or by swiping.
- Documentation
- Added guidance for the loading-toast behavior change and its verification.