Skip to content

Using Tabs will break with React 18 and Docusaurus v2.3 #8592

@anaclumos

Description

@anaclumos

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

It will break when using Docusaurus v2.3 and React 18 with Tabs, when yarn building.

[ERROR] Docusaurus server-side rendering could not render static page with path /docs/in
tro.


Error: Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
    at /sandbox/node_modules/@docusaurus/core/lib/webpack/utils.js:180:24
    at /sandbox/node_modules/webpack/lib/MultiCompiler.js:554:14
    at processQueueWorker (/sandbox/node_modules/webpack/lib/MultiCompiler.js:491:6)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
[INFO] Docusaurus version: 2.3.0
Node version: v16.15.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproducible demo

https://codesandbox.io/s/hungry-hodgkin-2z1jdc

Steps to reproduce

  1. Install a fresh Docusaurus 2.3
  2. yarn add react@18 react-dom@18
  3. Add the following:
    import Tabs from '@theme/Tabs';
    import TabItem from '@theme/TabItem';
    
    <Tabs>  
    <TabItem value="option 1" label="option 1">
    
    1
    
    </TabItem>  
    <TabItem value="option 2" label="option 2">
    
    2
    
    </TabItem>  
    </Tabs>  
    
  4. yarn dev works. yarn build fails.

Expected behavior

The build should not fail.

Actual behavior

The build fails.

Your environment

Self-service

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

Metadata

Metadata

Assignees

Labels

bugAn error in the Docusaurus core causing instability or issues with its executiondomain: themeRelated to the default theme components

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions