-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Nextjs Render Error caused by Scroll Trigger being enabled #603
Comments
Note, I am also seeing it on Next 15 canary
Repro case: https://replit.com/@robertwebb10/GSAP-Nextjs-Body-style-error-reprodution?v=1 |
robert-j-webb
changed the title
Nextjs Render Error caused by Scroll Trigger being imported
Nextjs Render Error caused by Scroll Trigger being enabled
Nov 26, 2024
I believe this was addressed here: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Repro case, on NextJS 15
Hi, I tracked down the cause of this error in the console:
I'm using NextJS 14.1.2, app router, gsap/react: 2.1.1
The code that causes this error is just:
I wanted to see if I could fix the problem, so I took a look at the source code and found some code that looked like a potential cause.
In the
enable
function, body style is modified twice link to codeI found that if I removed the two lines that modify body style, then the error went away.
So now it becomes:
Now I'm not sure what the suggested fix is. Probably you need to make sure your bounds calculation doesn't occur until after render.
You can wrap client side only checks like this in:
And then it won't run on the server, which is what is causing this error.
The text was updated successfully, but these errors were encountered: