react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

Array items rearrange with useTransition

Open ruthmpardee opened this issue 6 years ago • 5 comments

🐛 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.

GIPHY

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.27
  • react v16.12.0

ruthmpardee avatar Jun 10 '20 01:06 ruthmpardee

Confirmed this bug is not happening in v9: https://codesandbox.io/s/react-spring-cards-reordering-v9-dpfm1

ruthmpardee avatar Jun 10 '20 01:06 ruthmpardee

I'm running into this as well.

quantizor avatar Jun 19 '20 15:06 quantizor

@drcmda any chance you could take a look? Not sure where to start debugging

quantizor avatar Jun 19 '20 15:06 quantizor

Are there any updates on this bug?

theodoretliu avatar Nov 20 '20 22:11 theodoretliu

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 😄

joshuaellis avatar Mar 18 '21 17:03 joshuaellis