Skip to content
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

[bug]: styles are not updated when using useSprings in conjunction with deleting items from a list #2248

Open
5 tasks
DashaTratsevskaya opened this issue Jan 17, 2024 · 1 comment
Labels
template: bug This issue might be a bug

Comments

@DashaTratsevskaya
Copy link

Which react-spring target are you using?

  • @react-spring/web
  • @react-spring/three
  • @react-spring/native
  • @react-spring/konva
  • @react-spring/zdog

What version of react-spring are you using?

^9.5.2

What's Wrong?

when deleting elements from an array, if you start with any other element instead of the first one and reach the first one, the styles of the component are not updated after deleting the first one. Here is a quick example https://codesandbox.io/p/sandbox/pensive-snow-h9lv38 ?file=%2Fsrc%2Findex.tsx%3A8%2C12

To Reproduce

  1. click delete => the first item will be active
  2. click delete again => there isn't active item, all items have display:none style

Expected Behaviour

on the second step I expect to see the next active element, after deleting the first element

Link to repo

https://codesandbox.io/p/sandbox/pensive-snow-h9lv38 ?file=%2Fsrc%2Findex.tsx%3A8%2C12

@DashaTratsevskaya DashaTratsevskaya added the template: bug This issue might be a bug label Jan 17, 2024
@joshuaellis
Copy link
Member

For stuff like that IMO you'd probably want to use useTransition? Have you tried that? That hook is much better suited to what you're trying to do. I'm not sure this is a bug 🤔

@joshuaellis joshuaellis changed the title [bug]: Styles are not updated when using useSprings [bug]: styles are not updated when using useSprings in conjunction with deleting items from a list Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: bug This issue might be a bug
Projects
None yet
Development

No branches or pull requests

2 participants