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
useWindowScroll is SSR incompatible #1764
Comments
do you have a repro for this? |
from what i can see, this hook works as intended on the client and server: https://codesandbox.io/s/brave-yonath-4rxbje?file=/pages/index.js |
As I remember it "works" but triggers well known "hydration mismatch" warning. SSR compatible code must not have |
where do you see the hydration mismatch exactly ? unfortunately i can't see this error it in the codesandbox demo (i looked in the server and client console). if i can see the error, i will investigate and fix it. |
Fixed in 5.1.4, for this and other similar hooks – initial value is not set in useEffect |
What package has an issue
@mantine/hooks
Describe the bug
https://github.com/mantinedev/mantine/blob/master/src/mantine-hooks/src/use-window-scroll/use-window-scroll.ts#L10
relies on direct
window
checks, should be hidden behinduseEffect
.In which browser did the problem occur
Any
If possible, please include a link to a codesandbox with the reproduced problem
No response
Do you know how to fix the issue
No response
Are you willing to participate in fixing this issue and create a pull request with the fix
No response
Possible fix
Related thread on SO: https://stackoverflow.com/questions/57230099/react-ssr-proper-way-of-handling-page-scroll-position
The text was updated successfully, but these errors were encountered: