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.
@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.
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! 🙌🏻
Most helpful comment
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! 🙌🏻