Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 > 3.1.6 breaks the addons, 'channel' is null. #1370

Closed
samkelleher opened this issue Jun 28, 2017 · 2 comments
Closed

3.0.0 > 3.1.6 breaks the addons, 'channel' is null. #1370

samkelleher opened this issue Jun 28, 2017 · 2 comments

Comments

@samkelleher
Copy link

A simple upgrade has rendered addons such as the options and knobs addon non-functional. The resulting exception causes storybook to fail to run.

It seems to stem from the 'addons channel' being null.

render.js:65 TypeError: Cannot read property 'removeListener' of null
    at WrapStory.componentWillUnmount (WrapStory.js:76)
    at ReactCompositeComponent.js:408
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper.unmountComponent (ReactCompositeComponent.js:407)
    at Object.unmountComponent (ReactReconciler.js:78)
    at Object.unmountChildren (ReactChildReconciler.js:146)
    at ReactDOMComponent.unmountChildren (ReactMultiChild.js:371)
    at ReactDOMComponent.unmountComponent (ReactDOMComponent.js:990)
    at Object.unmountComponent (ReactReconciler.js:78)
    at ReactCompositeComponentWrapper.unmountComponent (ReactCompositeComponent.js:417)

This is the line refered to:

this.props.channel.removeListener('addon:knobs:knobChange', this.knobChanged);

And the config.js:

import { configure, addDecorator } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import Global from '../src/components/Global';

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

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

addDecorator(story => (
    <Global>
        {story()}
    </Global>
));

addDecorator(withKnobs);

configure(loadStories, module);

I tried adding the withKnobs call to the story itself, but made no difference. I also tried adding a setTimeout before calling withKnobs, also no change.

storiesOf('My Story', module)
    .addDecorator(withKnobs)

Gonna downgrade back to 3.0.0 where this works normally but can't seem to find an obvious call, but I know there have been a lot changes recently to storybook.

@shilman
Copy link
Member

shilman commented Jun 28, 2017

@samkelleher we have seen problems with peoples' npm setups. before you downgrade, can you clean out your node_modules and try a fresh install?

EDIT: also, if you have any yarn/npm lock files laying around, try nuking them too before you install.

@samkelleher
Copy link
Author

samkelleher commented Jun 28, 2017

thank @shilman I was just doing that as you wrote, I should have tried that first before reporting. My project has a shrinkwrap, deleting it solved my issues. Strange as I definitly had 3.1.6 of the storybooks packages in my modules directory.

thanks for the help and quick response today! 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants