Skip to content
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

Handle jsdom environments in Toaster when creating ref #172

Closed
wants to merge 2 commits into from
Closed

Handle jsdom environments in Toaster when creating ref #172

wants to merge 2 commits into from

Conversation

ahuth
Copy link

@ahuth ahuth commented Apr 18, 2022

Fixes #107.

In jsdom the rect will always have a height of 0, causing an infinite loop due to the t.height check.

Fixed by checking for t.height != null instead. That way 0 will be considered a valid height value, but it'll still initialize correctly when undefined or null.

@vercel
Copy link

vercel bot commented Apr 18, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timo/react-hot-toast/5RWtFzXuFy5XtZSX2azZYxfq9RVS
✅ Preview: https://react-hot-toast-git-fork-ahuth-patch-1-timo1.vercel.app

Fixes #107.

In jsdom the rect will always have a height of 0, causing an infinite loop due to the `t.height` check. Fixed by checking for `t.height != null` instead. That way `0` will be considered a valid height value, but it'll still initialize correctly when `undefined` or `null`.
@ahuth ahuth changed the title Handle jsdom environments in Toaster when creating the ref Handle jsdom environments in Toaster when creating ref Apr 18, 2022
@ahuth ahuth closed this May 2, 2022
@ahuth ahuth deleted the patch-1 branch May 2, 2022 16:21
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.

Unable to test with React Testing Library
1 participant