storybook: .addDecorator is probably not working
Issue by kitze
Friday Dec 23, 2016 at 23:37 GMT
_Originally opened as https://github.com/storybooks/storyshots/issues/68_
I’m using material-ui in my project for some of the components. The components that are not affected by material-ui and don’t need muiTheme pass the tests. But the other components that need muiTheme provided by context, are failing with a warning Warning: Failed context type: The context `muiTheme` is marked as required in `CircularProgress`, but its value is `undefined`.
Keep in mind that the stories in storybook are fine because I’m providing muiTheme through a decorator like this in my global .storybook/config.js file:
addDecorator(story => wrapWithStyles(story()));
addDecorator(story => wrapWithMui(story()));
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 19 (16 by maintainers)
Commits related to this issue
- Merge pull request #1481 from mattleff/fixes-877 Fixes #877, #879 — committed to storybookjs/storybook by shilman 7 years ago
I can fix the repro @ktj provided with the following diff:
This ensures that
addDecoratoris called before the stories are loaded.I’m guessing just moving the
addDecoratorline above therequire.contextline should work too, no?This seems like a documentation problem more than anything. Perhaps the global
addDecoratorshould log a warning if a story has already been registered, as this is unlikely to be what you want?@tmeasday Sure, I’ll try to send one in the next couple days.
I’ll mark it
mergedand we’ll close it when it gets released (soon!)