-
Notifications
You must be signed in to change notification settings - Fork 39
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
replace toaster
with new useToaster
api
#1351
Merged
Merged
Conversation
This file contains 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
mayank99
requested review from
gretanausedaite and
adamhock
and removed request for
a team
June 12, 2023 20:36
mayank99
force-pushed
the
mayank/use-toaster
branch
from
June 13, 2023 21:36
00207e0
to
2457974
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions. Other than that component looks much simpler!
gretanausedaite
approved these changes
Jun 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Merged
Merged
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.
Changes
The
Toaster
class instance been replaced with auseToaster
hook which returns an object that has properties matching the public functions in the old api.Only api change needed from user side is:
How it works
useToaster
hook simply dispatches reducer actions.<ToastProvider>
, which wraps the entire tree inside<ThemeProvider>
.<ThemeProvider>
renders a<Toaster>
which reads the state and renders<Toast>
s accordingly.TODO: Will work on unit testsFixed.Testing
Tested in vite playground and storybook.
Everything seems to work well. 🎉
Docs
Added changeset.
Need to fix website example.Fixed via #1353.Updated migration guide. https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v3-migration-guide#toaster