timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.84k stars 331 forks source link

Handle jsdom environments in Toaster when creating ref #172

Closed ahuth closed 2 years ago

ahuth commented 2 years ago

Fixes https://github.com/timolins/react-hot-toast/issues/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[bot] commented 2 years ago

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