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

Prevent warning on SSR context #13

Closed
ludovicmnji opened this issue Jan 23, 2020 · 4 comments
Closed

Prevent warning on SSR context #13

ludovicmnji opened this issue Jan 23, 2020 · 4 comments
Labels

Comments

@ludovicmnji
Copy link

🐛 Bug Report

If you use a Teleporter in SSR context app, you will get a warning because of the useLayoutEffect hook in createTeleporter() function.

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://fb.me/react-uselayouteffect-ssr for common fixes.

To Reproduce

Render an app using server-side rendering.

Expected behavior

It should not emit a warning on Node server.

@gregberge
Copy link
Owner

For now, react-teleporter is not compatible with SSR.

@slorber
Copy link

slorber commented Feb 24, 2021

Didn't study the problem much but what would it take to support SSR?

Is it something you'd like to support if someone implemented this?

I don't know any slot-fill / teleport lib that supports SSR since react-gateway is not maintained and it's annoying me for many use-cases 😅

@richardscarrott
Copy link

@slorber I don't think slots / teleporting libs can ever support SSR properly because, for example, react will render the a target in the header before it renders the source in the body.

I ran into this issue here cloudflare/react-gateway#49

@gregberge
Copy link
Owner

To be clear, it is your responsibility to not use react-teleporter server-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants