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]: UseSpring() Not firing in NextJS 14 #2361

Open
1 of 5 tasks
hq-aw opened this issue Mar 12, 2025 · 2 comments
Open
1 of 5 tasks

[bug]: UseSpring() Not firing in NextJS 14 #2361

hq-aw opened this issue Mar 12, 2025 · 2 comments
Labels
template: bug This issue might be a bug

Comments

@hq-aw
Copy link

hq-aw commented Mar 12, 2025

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

What's Wrong?

UseSpring() is not firing in NextJS 14 dev environment.

Using the first example from the docs:
https://codesandbox.io/p/devbox/bold-andras-ymxghg

To Reproduce

Use the NextJS 14 Starter, create a simple component with useSpring, run npm run dev

Expected Behaviour

The element should animate.

Link to repo

https://codesandbox.io/p/devbox/bold-andras-ymxghg

@hq-aw hq-aw added the template: bug This issue might be a bug label Mar 12, 2025
@hq-aw
Copy link
Author

hq-aw commented Mar 12, 2025

Apparently also the case in NextJS 13 #2146

@Stan-Stani
Copy link

Stan-Stani commented Mar 14, 2025

In Next 14 I was seeing a looped animation not start unless it was rerendered. I used a useEffect to toggle the pause spring prop once hydration (mounting) was complete and that made the animation start correctly even after page hard reload.

ETA: Ha, now it doesn't loop when I do a client side navigation back to the page though.

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