docs: warn against mounting more than one Toaster - #376
Open
kesha-antonov wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for sonner-native ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a short note to the README warning against mounting more than one
<Toaster />per app.Why
While investigating what looked like a duplicate/ghost toast bug in #370, we eventually traced our specific repro to an app-level mistake, not a library bug: a second
<Toaster />was mounted inside an internal shared package alongside the app's own top-level one. Since the toast store is a shared, module-level singleton, every mounted<Toaster />subscribes to and renders everytoast()call - so this silently duplicated every toast instead of erroring or warning.It's an easy trap in any codebase with independently-developed feature packages/providers, and the resulting symptom (toasts appearing to duplicate) looks confusingly similar to real animation/rendering bugs, so it's worth documenting explicitly rather than leaving it to be rediscovered by trial and error.
Test plan
Docs-only change, no code paths affected.