useTransition calls leave multiple times #1336
Unanswered
TriStarGod
asked this question in
Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🤓 Question
I've tried to re-implement the MessageHub to mirror the behavior found on your example website and I was able to do it successfully. However, I noticed that leave would be called multiple times.
Click message 1 time, it will call leave 1 time (expected)
Click message 2 times, it will call leave 3 times.
Click message 3 times, it will call leave 3 times.
Click message 4 times, it will call leave 10 times.
Is leave not suppose to be relied upon to occur the number of times / when it leaves the screen? I also tried using the example found at
https://github.com/react-spring/react-spring-examples/blob/v9/demos/hooks/notification-hub/index.js and tried v9.0.0 -rc3 but I had difficulty making it work to test the leave function. The github sample created unreliable notifications with v8.0.27 (ie click twice, wait a bit, click again; the last notification will zip by compared to the first ones) so I didn't use it.
Code - https://codesandbox.io/s/react-spring-messagehub-048q1?file=/src/index.js
Beta Was this translation helpful? Give feedback.
All reactions