Skip to content

fix: keep error toasts visible until dismissed - #30420

Merged
chrifro merged 6 commits into
mainfrom
fix/persistent-error-toasts
Oct 13, 2026
Merged

chrifro merged 6 commits into
mainfrom
fix/persistent-error-toasts

Conversation

@chrifro

@chrifro chrifro commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Error toasts now stay on screen until the user closes them, to meet WCAG 2.2.1 Timing Adjustable. Success, info, and warning toasts keep Sonner's default timer.

Fixes DEQ-463 (Open Cursor Desktop failure) and DEQ-310 (adding a user who is already in a group).

Sonner has no default duration per toast type, so this adds site/src/components/Toaster/toast.ts, a thin wrapper around Sonner's toast:

  • toast.error defaults to duration: Infinity. A caller can still set its own duration.
  • toast.promise failures get the same default. Sonner renders a rejected promise without calling toast.error, and the group member flow (DEQ-310) uses toast.promise.
  • All other methods pass straight through.

All toast imports now go through the wrapper. A Biome noRestrictedImports rule blocks importing toast directly from sonner, following the existing @pierre/diffs rule. Tests that mocked sonner now mock the wrapper. Most of the 130-file diff is the import swap.

Proof

Error toast on the create token page (duplicate name), with the pointer off the toast so Sonner doesn't pause the timer. Shots are taken once the enter animation has finished:

1 second after the error 11 seconds after the error
Before before 1s before 11s
After after 1s after 11s

Also checked in the running app: the close button dismisses the error toast, and a "Token created" success toast still disappears on its own.

toast.test.tsx covers the error and rejected toast.promise cases staying visible, dismissing them with the close button, and success toasts still timing out. With the persistent duration removed, the two error cases fail.

Decision log
  • A first version set duration: Infinity on the shared <Toaster> for every toast type. Product feedback: only error toasts were reported, so success and info toasts should keep their timer.
  • The wrapper sets the duration when each toast is created. The alternative was to watch toasts from <Toaster> with useSonner and change them afterward. That would add subscription and timer-ordering issues.
  • I didn't change Sonner's exported toast object in place. The wrapper plus a lint rule is explicit and enforced.
  • The experimental chat board undo toast (runPlan.ts) uses toast() with a timer that matches its undo window, so it isn't affected.
  • Not reproduced end to end: the Groups flow needs a Premium license, and the Cursor flow needs the app installed. Both use the toast.promise and toast.error paths the tests cover.

Generated by Coder Agents on behalf of @chrifro.

Error toasts, including rejected toast.promise calls, now stay on
screen until the user closes them (WCAG 2.2.1 Timing Adjustable).
Success, info, and warning toasts keep Sonner's timer.

Add a toast wrapper in site/src/components/Toaster/toast.ts, route all
imports through it, and add a Biome noRestrictedImports rule so new
code cannot import toast from sonner directly.

Fixes DEQ-463 and DEQ-310.
@linear-code

linear-code Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

DEQ-463

DEQ-310

…toasts

# Conflicts:
#	site/src/pages/AgentsPage/AgentCreatePage.test.tsx
#	site/src/pages/AgentsPage/AgentCreatePage.tsx
#	site/src/pages/AgentsPage/exp/chatBoard/BoardColumns.tsx
#	site/src/pages/AgentsPage/exp/chatBoard/ChatBoardPage.test.tsx
#	site/src/pages/AgentsPage/exp/chatBoard/ChatBoardPage.tsx
#	site/src/pages/AgentsPage/exp/chatBoard/assistants.test.ts
#	site/src/pages/AgentsPage/exp/chatBoard/assistants.ts
#	site/src/pages/AgentsPage/exp/chatBoard/runPlan.test.tsx
#	site/src/pages/AgentsPage/exp/chatBoard/runPlan.ts
@chrifro
chrifro marked this pull request as ready for review October 6, 2026 13:12
@chrifro
chrifro requested a review from a team as a code owner October 6, 2026 13:12
@chrifro
chrifro requested a review from aqandrew October 6, 2026 13:12

@aqandrew aqandrew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The new wrapper + its tests make sense to me, although I wonder if we're calling act unnecessarily (see comment).

Other than that, some code comments just need some trimming

Comment thread site/src/components/Toaster/toast.ts Resolved
Comment thread biome.jsonc Resolved
Comment thread site/src/components/Toaster/toast.ts Resolved
chrifro and others added 3 commits October 9, 2026 07:33
Trim redundant comments, shorten the biome restriction message, and drop
unnecessary act() wrappers in toast tests.
…toasts

# Conflicts:
#	site/src/hooks/useClipboard.test.tsx
#	site/src/pages/AgentsPage/AgentCreatePage.test.tsx
#	site/src/pages/AgentsPage/AgentsPageLayout.tsx
#	site/src/pages/AgentsPage/components/WebPushButton.tsx
#	site/src/pages/AgentsPage/utils/agentWorkspaceUtils.test.ts
#	site/src/pages/AgentsPage/utils/agentWorkspaceUtils.ts
@chrifro
chrifro requested a review from aqandrew October 9, 2026 08:55
…toasts

# Conflicts:
#	site/src/pages/AISettingsPage/InstructionsPage/OrganizationInstructionsSettings.tsx
#	site/src/pages/AgentsPage/AgentAutomationsPage.test.tsx
#	site/src/pages/AgentsPage/AgentAutomationsPage.tsx
#	site/src/pages/AgentsPage/components/ChatPageContent.tsx
#	site/src/pages/AgentsPage/components/ChatTopBar.test.tsx
#	site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx
@chrifro
chrifro merged commit d68b2c8 into main Oct 13, 2026
27 checks passed
@chrifro
chrifro deleted the fix/persistent-error-toasts branch October 13, 2026 07:21
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants