8000 fix(toaster): fix issue where delayed closing affects state by simonguo · Pull Request #4294 · rsuite/rsuite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(toaster): fix issue where delayed closing affects state #4294

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 2 commits into from
May 23, 2025

Conversation

simonguo
Copy link
Member

This pull request updates the useMessages function in src/toaster/ToastContainer.tsx to ensure state updates are based on the previous state, improving reliability when handling asynchronous updates.

State management improvements:

  • Updated the setMessages call to use a functional state update in the setTimeout for clearing all messages. This ensures the state update is based on the most recent state.
  • Updated the setMessages call to use a functional state update when filtering visible messages. This prevents potential issues caused by stale state references.

Copy link
codesandbox bot commented May 23, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
vercel bot commented May 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rsuite-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 1:23am
rsuite-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 1:23am

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.20%. Comparing base (6e39ebf) to head (ec87c13).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4294   +/-   ##
=======================================
  Coverage   89.20%   89.20%           
=======================================
  Files         525      525           
  Lines       12520    12539   +19     
  Branches     3212     3216    +4     
=======================================
+ Hits        11168    11185   +17     
  Misses        677      677           
- Partials      675      677    +2     
Flag Coverage Δ
ChromeCi 89.14% <100.00%> (+<0.01%) ⬆️
Firefox 89.11% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simonguo simonguo merged commit 3279371 into main May 23, 2025
16 checks passed
@simonguo simonguo deleted the fix-toaster-stale-closure-4291 branch May 23, 2025 01:27
@simonguo
Copy link
Member Author

fix: #4291

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.

1 participant
0