jbrowse-components: Warning in tests/MainThreadRpcDriver: useLayoutEffect does nothing on the server
This warning shows up in tests on master branch (see e.g. here) and anytime that MainThreadRpcDriver is used:
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.
It looks like this is related to Material-UI, and the warning appears when server-side rendering is done in an environment where a DOM is detected (like when everything is done in the main thread, which we do in out tests). Further reference: https://github.com/mui-org/material-ui/issues/15798
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (4 by maintainers)
but you are saying it could be triggered by other portions of the codebase as well…
if you comment out this section in config/jest/console.js
then you will get a ton of useLayoutEffect warnings when running tests
this will match also what is seen when using MainThreadRpc in the app since tests use MainThreadRpc
The only reason we don’t get those warnings in the tests right now is because of that code snippet which silences them