hipstersmoothie / storybook-dark-mode

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

Can't launch storybook. Misconfiguration ? #148

Closed DorianMaliszewski closed 1 year ago

DorianMaliszewski commented 3 years ago

Informations

export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, controls: { matchers: { color: /(background|color)$/i, date: /Date$/, }, }, options: { storySort: { method: '', order: ['Introduction', 'Components', 'Credits'], locales: '', }, }, darkMode: { // Override the default dark theme dark: { ...themes.dark, appBg: 'black' }, // Override the default light theme light: { ...themes.normal, appBg: 'red' }, darkClass: 'dark', lightClass: 'light', current: 'dark', classTarget: 'html', stylePreview: true }, }

export const decorators = [ (Story) => (

), ]

- manager.js 
```js
import { addons } from '@storybook/addons'
import theme from './theme'

addons.setConfig({
  isFullscreen: false,
  showNav: true,
  showPanel: true,
  panelPosition: 'bottom',
  enableShortcuts: true,
  isToolshown: true,
  theme,
  selectedPanel: undefined,
  initialActive: 'sidebar',
  sidebar: {
    showRoots: true,
    collapsedRoots: [''],
  },
})

Error description

Starting my storybook result in blank page with the following error : Uncaught DOMException: Failed to execute 'remove' on 'DOMTokenList': The token provided must not be empty.. What is the solution here ?

Screenshot

Capture d’écran 2021-04-29 à 13 32 32
PhilGarb commented 3 years ago

I had a similar error after passing an object instead of a string to the configuration. I solved it by cleaning the local storage. It seems like the configuration is persisted there and not properly updated.

cjkoepke commented 3 years ago

I can confirm that localStorage.clear() was a fix for this.