SSR: hydration breaks when using emotion
See original GitHub issue🐛 Bug Report
Hydration fails when using @emotion/styled
as a loadable-component.
main-bundle-4c93d0b8.js:22 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
at su (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:86651)
at dl (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:99858)
at t.unstable_runWithPriority (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:30:3844)
at $o (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:45024)
at pl (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:97718)
at Zu (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:93872)
at Hu (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:90437)
at jl (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:111885)
at http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:113128
at tl (http://localhost:9000/dist/web/main-bundle-4c93d0b8.js:22:94020)
To Reproduce
Styled.js
import styled from '@emotion/styled';
const Styled = styled.div`color: turquoise;`;
export default Styled;
App.js
const Styled = loadable(() => import('./Styled'))
const App = () => <Styled>Hi</Styled>
Link to repl or repo
https://github.com/irudoy/emotion-loadable-repro (based on https://github.com/gregberge/loadable-components/tree/master/examples/server-side-rendering)
## System:
- OS: macOS 10.15.4
- CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
- Memory: 1.87 GB / 16.00 GB
- Shell: 5.7.1 - /bin/zsh
## Binaries:
- Node: 13.10.1 - /usr/local/bin/node
- Yarn: 1.22.4 - /usr/local/bin/yarn
- npm: 6.14.2 - /usr/local/bin/npm
- Watchman: 4.9.0 - /usr/local/bin/watchman
## npmPackages:
- @loadable/babel-plugin: ^5.10.3 => 5.12.0
- @loadable/component: ^5.10.3 => 5.12.0
- @loadable/server: ^5.10.3 => 5.12.0
- @loadable/webpack-plugin: ^5.7.1 => 5.12.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Server Side Rendering - Emotion
hydrate. hydrate should be called on the client with the ids that extractCritical returns. If you don't call it then Emotion will reinsert...
Read more >react-hydration-error - Next.js
The first render is called Hydration which is a feature of React. This can cause the React tree to be out of sync...
Read more >Handling the React server hydration mismatch error
How to resolve the server mismatch error when hydrating a shared React component that can be used in client-side only or server-side ...
Read more >Server-side rendering broken after upgrading to MUI 5 (with ...
Today, I have been working on this same issue on my side and I found the solution. You should remove your StyledEngineProvider from...
Read more >vite-ssr - npm
There are 6 other projects in the npm registry using vite-ssr. ... as part of the server-rendered HTML for later hydration in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I saw this error in a
NewRelic
. However, was not able to found the root cause.bump