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]: in v9.5.1 the first element in useTransition not expiring #1948

Closed
2 of 5 tasks
walteh opened this issue Jul 22, 2022 · 4 comments · Fixed by #1949
Closed
2 of 5 tasks

[bug]: in v9.5.1 the first element in useTransition not expiring #1948

walteh opened this issue Jul 22, 2022 · 4 comments · Fixed by #1949
Labels
area: core relates to core classes // parts of the library kind: bug Something isn't working released This has been released on stable

Comments

@walteh
Copy link

walteh commented Jul 22, 2022

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?

v9.5.1

What's Wrong?

I just updated to v9.5.1 and a useTranstion hook that I have been using successfully for the last few months is failing in react-native. I also tested in react for the codesandbox and I am seeing the same result.

Basically the components just pile on top of each other instead of transitioning. Seems like a consistent issue is that the first one that renders never leaves.

I have noticed that sometimes it starts working fine eventually, but always after mount it is failing.

Example:

v9.5.0.mov
v9.5.1.mov

To Reproduce

Please see link below - I hacked together a quick poc using the exact same useTransition logic from my project but simplified everything else.

Apologies about the styling and crappy logic, just trying to boil the issue down.

Expected Behaviour

Only one component shows at a time.

Link to repo

https://codesandbox.io/s/stupefied-rui-zhov18

@walteh walteh added the template: bug This issue might be a bug label Jul 22, 2022
@joshuaellis
Copy link
Member

That's a weird bug. Even weirder it doesn't happen when you attach a springRef.

Thanks for reporting.

@joshuaellis joshuaellis added kind: bug Something isn't working area: core relates to core classes // parts of the library and removed template: bug This issue might be a bug labels Jul 22, 2022
joshuaellis added a commit that referenced this issue Jul 22, 2022
@joshuaellis
Copy link
Member

@dub6ix, you can see a sandbox with the fix in #1949 here – https://codesandbox.io/s/vigorous-nash-r5791n?file=/src/App.tsx

This is actually the correct behaviour, because you've passed deps to the function, your second argument returned is a SpringRef & all animations should be queued until that ref is started (this is the behaviour across all hooks).

If you remove the deps array from your transition will work as intended, automatically running.

@walteh
Copy link
Author

walteh commented Jul 23, 2022

@joshuaellis awesome, this makes sense now! Huge thanks for the clarification and quick response (esp on a Friday). Can confirm this now work in my project at v9.5.1!

Closing as this is the intended behavior.

@walteh walteh closed this as completed Jul 23, 2022
@joshuaellis
Copy link
Member

That's been released on 9.5.2

@joshuaellis joshuaellis added the released This has been released on stable label Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core relates to core classes // parts of the library kind: bug Something isn't working released This has been released on stable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants