-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
useTransition: Fix deleted items handing #852
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
Conversation
Did you try v9 or the latest canary? |
Nope, forgot to check. Will do that right now, thanks! Also, I think this patch might break added items. |
The |
Thanks. I've got the canary installed and can confirm it doesn't have this issue. Some things I experienced during the upgrade:
I had to change
to
or else the animation wouldn't work.
No longer works as before. The component doesn't unmount when null. But that makes sense given the new API? Thank you! |
Not sure what you mean. Make a minimal sandbox? |
Sorry, that was confusing. Here is
In 8.27, In the canary, the animation works but |
@dminkovsky By default, |
Ah yes, that's it. Now I see it explained over in #809 too. Thanks a lot! |
The sentence above is from the OP in #809. It seems that your example should fit the 2nd condition, so I think this is a bug. I might have looked into this before, but I don't remember. I'll definitely look into it again before v9 is released. There's a good chance your example won't need |
That sounds great. However it shakes out, much appreciated. |
I think there is an issue with EDIT not able to replicate in a sandbox. |
Not sure why I'm not replicating in code sandbox but the issue appears to be here: I have a call like
|
When a function is passed to useSpring (and the "deps" argument is undefined), it should never be called more than once. Reported by: https://github.com/react-spring/react-spring/pull/852\#issuecomment-552581098
When a function is passed to useSpring (and the "deps" argument is undefined), it should never be called more than once. Reported by: https://github.com/react-spring/react-spring/pull/852\#issuecomment-552581098
@dminkovsky Whoops, thanks for pointing that out! Should be fixed in the latest canary. 👍 |
Awesome, thank you. Is Spectrum the best way to keep up with the canaries? Should I open new issues here for canary-related things? |
Yes
Sure, or you could comment in #808 for the canaries that contain |
When a function is passed to useSpring (and the "deps" argument is undefined), it should never be called more than once. Reported by: https://github.com/react-spring/react-spring/pull/852\#issuecomment-552581098
When a function is passed to useSpring (and the "deps" argument is undefined), it should never be called more than once. Reported by: https://github.com/react-spring/react-spring/pull/852\#issuecomment-552581098
I am bumping up against this line https://github.com/react-spring/react-spring/blob/66087e18b64d6c6d5fd75f6d84e85ed59714769d/src/useTransition.js#L256. I have a list of items, and when consecutive items are removed from the list, this line of code causes all items that had their previous sibling removed to jump to the top of the list. For example:
This can get really jarring if lots of items are moved to the top.
This PR simplifies the behavior by sorting the resulting list relative to the previous list. References to
left
andright
are removed.right
was not being used already, and left isleft
is removed due to this PR.After this PR: