Storybook: 3.0.0> 3.1.6破坏了插件,'channel'为空。

创建于 2017-06-28  ·  2评论  ·  资料来源: storybookjs/storybook

一个简单的升级使附加组件(例如,选项和旋钮附加组件)不起作用。 产生的异常导致故事书无法运行。

它似乎源于“附加频道”为空。

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.props.channel.removeListener('addon:knobs:knobChange', this.knobChanged);

和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);

我尝试将withKnobs调用添加到故事本身,但没有区别。 我还尝试在调用withKnobs之前添加setTimeout,也没有更改。

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

降级到3.0.0可以正常工作,但似乎找不到明显的呼声,但我知道故事书最近发生了很大变化。

knobs options question / support

最有用的评论

谢谢@shilman,我只是在写

感谢您今天的帮助和快速回复! 🙌🏻

所有2条评论

@samkelleher我们发现人们的npm设置存在问题。 在降级之前,您可以清理node_modules并尝试重新安装吗?

编辑:此外,如果周围有任何yarn / npm锁定文件,请在安装之前尝试对其进行裸核。

谢谢@shilman,我只是在写

感谢您今天的帮助和快速回复! 🙌🏻

此页面是否有帮助?
0 / 5 - 0 等级