Skip to content

fix: Toasts can be auto-dismissed when concurrent mode is enabled #918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025

Conversation

frankieyan
Copy link
Member

@frankieyan frankieyan commented May 8, 2025

Short description

This updates the Toast component so that its auto dismiss effect is compatible with new <StrictMode> behaviours in dev mode. As we can no longer assume effects are just run once, this removes the timeoutRunning state, reducing the reliance on the setupAutoDismiss effect and instead allow startTimeout to set the timeout directly.

Test plan

  • Run storybook and navigate to http://localhost:6006/?path=/docs/design-system-toast--notification-toasts-story.
  • Verify that toasts are dismissed after 10s
  • Verify that hovering your mouse over the toasts prevents it from auto dismissing, and moving the cursor off restarts the timeout
  • Optional: we can't test Reactist's storybook in React 18 without upgrading Storybook, so we can follow the instructions on using yelc to run this within Todoist, specifically this branch where we boot React with createRoot

Reference

https://react.dev/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development

PR Checklist

  • Added tests for bugs / new features
  • Updated docs (storybooks, readme)
  • Reviewed and approved Chromatic visual regression tests in CI

@frankieyan frankieyan requested review from a team and craigcarlyle and removed request for a team May 8, 2025 00:12
@frankieyan frankieyan merged commit e10ef2a into main May 9, 2025
9 checks passed
@frankieyan frankieyan deleted the frankie/concurrent-mode-toasts branch May 9, 2025 02:12
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.

2 participants