hipstersmoothie / storybook-dark-mode

A storybook addon that lets your users toggle between dark and light mode.
MIT License
428 stars 56 forks source link

Failed to execute 'remove' on 'DOMTokenList': The token provided must not be empty. #252

Closed lorcan-codes closed 4 months ago

lorcan-codes commented 4 months ago

I added the configuration below in preview.js

export const parameters = {
  darkMode: {
    classTarget: "body",
    dark: themes.dark,
    darkClass: ["dark"],
    light: themes.light,
    lightClass: ["light"],
    stylePreview: true,
    userHasExplicitlySetTheTheme: false,
  },
}

I am getting an error below when I run the storybook.

Failed to execute 'remove' on 'DOMTokenList': The token provided must not be empty.

Does toggleDarkClass handle the case where body/html does not have any classes?

storybook-dark-error
lorcan-codes commented 4 months ago

It was a cache issue.