Skip to content

Error when toggle theme: Maximum call stack size exceeded #8594

@baur

Description

@baur

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 got an error when theme toggling

Reproducible demo

No response

Steps to reproduce

  1. npx create-docusaurus@latest my-website classic
  2. Just toggle the theme dark <> light

Expected behavior

no error on the console

Actual behavior

Uncaught RangeError: Maximum call stack size exceeded.
    at dispatchChangeEvent (storageUtils.ts?10b8:23:1)
    at Object.set (storageUtils.ts?10b8:131:1)
    at storeColorMode (colorMode.tsx?7cd1:47:1)
    at eval (colorMode.tsx?7cd1:72:1)
    at onChange (colorMode.tsx?7cd1:72:1)
    at dispatchChangeEvent (storageUtils.ts?10b8:23:1)
    at Object.set (storageUtils.ts?10b8:131:1)
    at storeColorMode (colorMode.tsx?7cd1:47:1)
    at eval (colorMode.tsx?7cd1:72:1)
    at onChange (colorMode.tsx?7cd1:72:1)

image

Your environment

  • Docusaurus version used: 2.3.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node 18
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windwos11

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