question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
theKasheycommented, May 13, 2020

I saw this error in a NewRelic. However, was not able to found the root cause.

0reactions
irudoycommented, Oct 7, 2020

bump

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found