-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Add globalLimit prop to control maximum visible toasts per provider #76
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
feat: Add globalLimit prop to control maximum visible toasts per provider #76
Conversation
|
Thank you for your PR! I will be reviewing this alongside other global props that I would like to add as well (a global position prop and a global duration prop) |
|
Thanks for the PR! @dana-y. I've just released 0.15.0. I would like to release this change in 0.15.1. I've merged 0.15.0 into your branch. Before I merge, can you please add a test in |
|
@nickdebaise Thank you for your kind reply! 🤗 |
* docs: add Korean translation (README-ko.md) and language switch links (#77) * docs: add Korean translation for README * docs: add language switch links to README and README-ko.md - Added English ↔ Korean navigation links at the top of both files - Helps users easily switch between README.md and README-ko.md * fix: web support (#78) * fix: web support * fix: fix interactivity on mobile, add param for screen reader, update docs --------- Co-authored-by: Nick DeBaise <[email protected]> * feat: Add globalLimit prop to control maximum visible toasts per provider (#76) * feat: add globalLimit option to control the maximum number of toasts displayed * Use optional chaining for toastOptions.limit * fix: fix up merge conflict. Note-to-self: Do not use Github web UI for merginggit add * feat: add unit test for toast limit functionality based on globalLimit prop * fix: update toast dismissal method in tests from dismiss() to remove() for consistency --------- Co-authored-by: Nick DeBaise <[email protected]> --------- Co-authored-by: Suin Kim <[email protected]> Co-authored-by: Micael Dias <[email protected]> Co-authored-by: daeun.yang <[email protected]>
Summary
This PR adds a
globalLimitprop to the<Toasts />component, allowing developers to control the maximum number of toasts displayed per provider instance.Motivation
First of all, I want to say that I've been using this library extensively and it's been fantastic! 🎉
Currently, the toast limit is hardcoded at 20 toasts in the store. While this works well for most cases, there are scenarios where different providers might need different limits:
Changes
Core Changes
limit?: numbertoDefaultToastOptionstypeuseStoreto respect the limit option when filtering toastsglobalLimit?: numberprop that gets passed touseToasterExample Updates
globalLimit={5}globalLimit={3}API
This follows the existing pattern of
globalAnimationTypeandglobalAnimationConfigprops.I'm happy to make any changes or adjustments you'd like to see. Thank you for maintaining such a great library! 🙏