react-theming / storybook-addon-material-ui

Addon for storybook wich wrap material-ui components into MuiThemeProvider. :page_with_curl: This helps and simplifies development of material-ui based components.

Home Page:https://github.com/sm-react/storybook-addon-material-ui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught Error: Accessing nonexistent addons channel

remarcable opened this issue · comments

commented

Hello there,

I'm not sure if it's a problem of this project, but at least it seems to be related.
When using storybook with this addon, everything builds normally, but an error gets thrown at runtime:

index.js:39 Uncaught Error: Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel
    at AddonStore.getChannel (index.js:39)
    at muiTheme (muiTheme.js:48)
    at Object.<anonymous> (config.js:12)
    at Object.defineProperty.value (config.js:19)
    at __webpack_require__ (bootstrap 21742c234614f94ef929:678)
    at fn (bootstrap 21742c234614f94ef929:88)
    at Object.window.STORYBOOK_REACT_CLASSES (ReactPropTypesSecret.js:12)
    at __webpack_require__ (bootstrap 21742c234614f94ef929:678)
    at bootstrap 21742c234614f94ef929:724
    at preview.bundle.js:728
getChannel @ index.js:39
muiTheme @ muiTheme.js:48
(anonymous) @ config.js:12
Object.defineProperty.value @ config.js:19
__webpack_require__ @ bootstrap 21742c234614f94ef929:678
fn @ bootstrap 21742c234614f94ef929:88
window.STORYBOOK_REACT_CLASSES @ ReactPropTypesSecret.js:12
__webpack_require__ @ bootstrap 21742c234614f94ef929:678
(anonymous) @ bootstrap 21742c234614f94ef929:724
(anonymous) @ preview.bundle.js:728

Opening muiTheme.js on line 48 reveals that it indeed accesses an addon channel.

My addons.js looks like this, nothing special:

import 'storybook-addon-material-ui';
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';

and my config.js like this:

import { configure, addDecorator } from '@storybook/react';
import { muiTheme } from 'storybook-addon-material-ui';
import { theme } from '../imports/ui/components/theme';
import '../client/main.css';

const req = require.context('../imports/ui/components', true, /\.stories\.js$/);

function loadStories() {
  req.keys().forEach(filename => req(filename));
}

addDecorator(muiTheme([
  'Light Theme',
  'Dark Theme',
  theme,
]));


configure(loadStories, module);

What do you think is the problem? Even when not loading any stories this seems to happen. Thank you very much!

"storybook-addon-material-ui": "^0.8.2"
"@storybook/addons": "^3.3.15",
"@storybook/react": "^3.3.15"

Hi @lightningboss thanks for reporting it! I'll check it

commented

Hey @usulpro, is there an update on this one?

@lightningboss sorry for late answer
this kind of bug happens when you have two different versions of @storybook/addons
if it's this case you can remove both and install the latest.
Nevertheless, I updated dependencies, so after updating this addon and storybook to the latest versions it should works fine