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

Fix useLayoutEffect warning for SSR with React #1656

Closed
wants to merge 1 commit into from
Closed

Fix useLayoutEffect warning for SSR with React #1656

wants to merge 1 commit into from

Conversation

JovanShandro
Copy link
Contributor

We tried using the JsonForms component when doing server side rendering with react using
ReactDomServer and because of the use of the useLayoutEffect hook, we would get a warning of 'Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format...' all the time.

This pull request removes the warning by using useEffect instead if we are not in the browser.

Thank you!

@CLAassistant
Copy link

CLAassistant commented Nov 13, 2020

CLA assistant check
All committers have signed the CLA.

@sdirix
Copy link
Member

sdirix commented Nov 13, 2020

Thanks for this contribution! We also want to remove the useLayoutEffect hook and are already working on it. We want to merge soon so the next (alpha) release should already have these changes in it.

@JovanShandro
Copy link
Contributor Author

JovanShandro commented Nov 13, 2020

Thanks for this contribution! We also want to remove the useLayoutEffect hook and are already working on it. We want to merge soon so the next (alpha) release should already have these changes in it.

Thank you for the quick reply! Glad to hear that.

@sdirix
Copy link
Member

sdirix commented Nov 18, 2020

#1655 is now merged. The next release of JSON Forms will no longer contain the useLayoutEffect hook 👍

@sdirix sdirix closed this Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants