Array items rearrange with useTransition
See original GitHub issue🐛 Bug Report
When using useTransition
with an array of items, when the items are transitioning out of the DOM, the order of the items changes; the array is rearranged.
https://codesandbox.io/s/react-spring-cards-reordering-8tckt
To Reproduce
Steps to reproduce the behavior: See sandbox: https://codesandbox.io/s/react-spring-cards-reordering-8tckt
When using useTransition
from [ 1, 2 ] to [ 1, 2, 3, 4] back to [ 1, 2 ], the order temporarily changes to [ 4, 1, 2, 3 ] while the transition is happening.
Expected behavior
I would expect the order to stay the same while transitioning back (it should always be [ 1, 2, 3, 4 ])
Link to repro (highly encouraged)
https://codesandbox.io/s/react-spring-cards-reordering-8tckt
Environment
react-spring
v8.0.27react
v16.12.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
useTransition on Array return undefined Array propeties ...
The API for useTransition has change in v9 and is documented. ... return ( <> <div className="ppl-lst"> {transitions((props, item) ...
Read more >useTransition "update" prop applies when order is unchanged
We could add a reorder prop, which updates the animations of any item with a new ... @aleclarson i thought update prop triggers...
Read more >useTransition - React Docs
useTransition returns an array with exactly two items: ... For example, if the user clicks a tab but then change their mind and...
Read more >useTransition and useDeferredValue in React 18
Since there are 20,000 elements in the array, filtering is going to be ... useTransition hook to tell React that a certain state...
Read more >useTransition - react-spring
Item is defined a lot below, it's automatically inferred from what you pass as the content of the array you pass as the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed this bug is not happening in v9: https://codesandbox.io/s/react-spring-cards-reordering-v9-dpfm1
closing due to inactivity & it’s fixed in v9. please use discussions or discord if you want more help or please consider creating a PR if you want to add a feature 😄