Skip to content

fix(web): add dismiss control for error toasts#897

Open
binbandit wants to merge 2 commits intopingdotgg:mainfrom
binbandit:t3code/add-toast-close-button
Open

fix(web): add dismiss control for error toasts#897
binbandit wants to merge 2 commits intopingdotgg:mainfrom
binbandit:t3code/add-toast-close-button

Conversation

@binbandit
Copy link
Contributor

@binbandit binbandit commented Mar 11, 2026

Summary

  • add a dismiss button for error toasts using Base UI's close primitive
  • reuse shared toast card content so stacked and anchored toast cards stay aligned
  • add app-level browser coverage for dismissing the follow-up keybindings error toast

Why

  • error toasts were only dismissible via swipe, which is awkward on desktop and trackpads
  • using the built-in Base UI close primitive keeps dismissal behavior on the supported path

Validation

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run test:browser src/components/KeybindingsToast.browser.tsx -t "lets users dismiss the follow-up error toast from the keybindings warning action"
  • note: bun run test:browser src/components/KeybindingsToast.browser.tsx still reports a pre-existing WorkerPoolManager: workers failed to initialize unhandled rejection from @pierre/diffs/react

Note

Add dismiss button to error toasts in the web UI

  • Adds ErrorToastDismissButton (an XIcon close control) to both Toasts and AnchoredToasts components in toast.tsx when toast.type === 'error'.
  • Extracts a shared ToastCardContent component to centralize toast layout and conditionally render the dismiss button.
  • Adds a browser test in KeybindingsToast.browser.tsx verifying the error toast dismiss button appears and removes the toast when clicked.

Macroscope summarized c73c714.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6da8ac8c-7ddb-4cb9-921b-ff238a3bd049

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 11, 2026
Copy link

Choose a reason for hiding this comment

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

🟢 Low

Issue on line in apps/web/src/components/KeybindingsToast.browser.tsx:419:

In the catch block at line 421, remounted.cleanup() is never called when an error occurs between lines 408–419. The cleanup only calls mounted.cleanup(), but mounted was already cleaned at line 407, leaving remounted resources leaked. Ensure remounted.cleanup() is called in the catch block before re-throwing.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/components/KeybindingsToast.browser.tsx around line 419:

In the catch block at line 421, `remounted.cleanup()` is never called when an error occurs between lines 408–419. The cleanup only calls `mounted.cleanup()`, but `mounted` was already cleaned at line 407, leaving `remounted` resources leaked. Ensure `remounted.cleanup()` is called in the catch block before re-throwing.

Evidence trail:
apps/web/src/components/KeybindingsToast.browser.tsx lines 400-426 at REVIEWED_COMMIT: Line 407 calls `await mounted.cleanup()`, line 408 creates `const remounted = await mountApp()`, line 420 calls `await remounted.cleanup()` in happy path, but catch block at lines 421-423 only calls `await mounted.cleanup().catch(() => {})` - missing `remounted.cleanup()` for errors between lines 408-419.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c73c714. The catch path now cleans up remounted before rethrowing, and I isolated this browser suite from the diff worker pool so CI no longer fails on unrelated worker initialization during repeated mount/unmount cycles.

@binbandit binbandit mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant