Skip to content

Hydration failed because the initial UI does not match what was rendered on the server. #9884

@Zamiell

Description

@Zamiell

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I upgraded my version of Docusaurus (and other dependencies), and now I am getting the following run-time error after deploying my website to production:

Docusaurus React Root onRecoverableError: Error: Minified React error #418; visit https://reactjs.org/docs/error-decoder.html?invariant=418 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at ps (main.5876dbc2.js:2:432456)
    at xr (main.5876dbc2.js:2:505502)
    at Tp (main.5876dbc2.js:2:492976)
    at Sp (main.5876dbc2.js:2:492948)
    at sp (main.5876dbc2.js:2:487998)
    at _ (main.5876dbc2.js:2:556368)
    at MessagePort.V (main.5876dbc2.js:2:556900) ObjectcomponentStack: "\n    at li\n    at p\n    at div\n    at div\n    at m (http://localhost:3000/assets/js/1df93b7f.2c283689.js:1:1042)\n    at div\n    at div\n    at section\n    at g\n    at main\n    at l (http://localhost:3000/assets/js/main.5876dbc2.js:2:107880)\n    at div\n    at I (http://localhost:3000/assets/js/main.5876dbc2.js:2:120020)\n    at l (http://localhost:3000/assets/js/main.5876dbc2.js:2:160297)\n    at c (http://localhost:3000/assets/js/main.5876dbc2.js:2:160630)\n    at http://localhost:3000/assets/js/main.5876dbc2.js:2:149184\n    at l (http://localhost:3000/assets/js/main.5876dbc2.js:2:167130)\n    at f (http://localhost:3000/assets/js/main.5876dbc2.js:2:167322)\n    at h (http://localhost:3000/assets/js/main.5876dbc2.js:2:158106)\n    at b (http://localhost:3000/assets/js/main.5876dbc2.js:2:158199)\n    at p (http://localhost:3000/assets/js/main.5876dbc2.js:2:169184)\n    at f (http://localhost:3000/assets/js/main.5876dbc2.js:2:154731)\n    at h (http://localhost:3000/assets/js/main.5876dbc2.js:2:155668)\n    at http://localhost:3000/assets/js/main.5876dbc2.js:2:168242\n    at kt (http://localhost:3000/assets/js/main.5876dbc2.js:2:149305)\n    at Pt (http://localhost:3000/assets/js/main.5876dbc2.js:2:150091)\n    at b\n    at o (http://localhost:3000/assets/js/main.5876dbc2.js:2:112757)\n    at i (http://localhost:3000/assets/js/main.5876dbc2.js:2:533457)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:543223)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:544171)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:543223)\n    at R (http://localhost:3000/assets/js/main.5876dbc2.js:2:2713)\n    at M (http://localhost:3000/assets/js/main.5876dbc2.js:2:3406)\n    at l (http://localhost:3000/assets/js/main.5876dbc2.js:2:529)\n    at o (http://localhost:3000/assets/js/main.5876dbc2.js:2:201)\n    at m (http://localhost:3000/assets/js/main.5876dbc2.js:2:106701)\n    at l (http://localhost:3000/assets/js/main.5876dbc2.js:2:107880)\n    at K (http://localhost:3000/assets/js/main.5876dbc2.js:2:6794)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:541437)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:536748)\n    at t (http://localhost:3000/assets/js/main.5876dbc2.js:2:522358)"digest: null[[Prototype]]: Object
i @ main.5876dbc2.js:2

Since the error is new, I suspect it is a regression in Docusaurus, thus I am posting it here.

Importantly, the error does not appear when running the website in dev (i.e. with docusaurus start), only after doing docusaurus build && docusaurus serve.

Steps to reproduce

git clone https://github.com/IsaacScript/isaacscript.git
cd isaacscript
git checkout b414f35680c44134e7dc1da076308750273ac63d
yarn install
cd packages/docs
npm run start

The website will open. Notice that there are no run-time errors in the browser's JavaScript console. Next, cancel the development server and then do:

npm run build && npm run serve

Notice the run-time error appear.

More info

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionclosed: wontfixA fix will bring significant overhead, or is out of scope (for feature requests)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions