-
Notifications
You must be signed in to change notification settings - Fork 341
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
Add dynamic height state (+ add test setup) #207
Conversation
In unit testing measuring dimensions is impossible, so toast height evaluates to `0`, which causes Toaster to endlessly recompute the height and update the store. Instead we're being more specific and checking whether height is `undefined`, and memoizing the ref so that it isn't being called on every render. This also required other tweaks like properly memoizing handlers like `updateHeight` so that they can be used as hook dependencies. (We only needed `updateHeight` to be memoized, though.)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Am I right in thinking the only thing blocking this is the size-limit check? Anything we can do to help this along? |
@themagickoala Indeed, and it feels weird to block it because of it. Wanted to stay true to the "less than 5kb including styles" claim. There is #217 which would decrease bundle size below 5kb again. Maybe even won't even hit 5kb as the check returns only That said, I think we'll just merge before blocking it any longer. |
Thanks @timolins! Will there be a release going out with this soon? My current solution is to mock the library and test the toast method was called, and I'd love to get back to real userland testing. |
Hi @themagickoala – sorry for the delay! I just released 2.4.0-beta.0, which includes those changes. Let me know how it works for you. |
Hi @timolins just picked this up today and it looks like this does fix our tests. Thanks so much! |
And thanks @silvenon for implementing this! |
Yay! 🎉 |
MutationObserver
- fixes Toast height calculation bug #133