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

Remix: react-archer seems to not be compatible with SSR #186

Closed
louislefebvre opened this issue Dec 7, 2022 · 4 comments
Closed

Remix: react-archer seems to not be compatible with SSR #186

louislefebvre opened this issue Dec 7, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@louislefebvre
Copy link

Thanks for the quick fix with 4.2.1!

Lines are now drawn, but there is now this following error output in Remix server console:

Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.

On my side, this got fixed using this remix utility to use my component client side only: https://github.com/sergiodxa/remix-utils#clientonly

I wanted to share the fix I have found here, although in case you have another way to manage it with SSR, I would love to hear your opinion :)!

Originally posted by @louislefebvre in #184 (comment)

@pierpo
Copy link
Owner

pierpo commented Dec 7, 2022

Hey! Thank you indeed, I noticed this while working on the fix. I should've bothered fixing ;)

The "fix" I thought of, tough, is merely an ignore of the warning: https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a
Which would be fine since there is no other solution haha. We can't have the server draw the arrows, so it makes sense.

@pierpo pierpo added the bug Something isn't working label Dec 7, 2022
@pierpo
Copy link
Owner

pierpo commented Dec 7, 2022

Fixed with 4.2.2!

@pierpo pierpo closed this as completed Dec 7, 2022
@louislefebvre
Copy link
Author

Thanks a lot for the quick fix and the medium post! 😍
However I notice that 4.2.2 has not been published to npmjs.

@pierpo
Copy link
Owner

pierpo commented Dec 8, 2022

Oops! Forgot to run the publish command, haha.
Thank you, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants