-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Global addDecorator not loaded #1755
Comments
@creaux did you try to put function loadStories() {
addDecorator(withThemes);
spread.keys().forEach(filename => spread(filename));
} |
it didn't help. I'm awaring it has something to have with that I'm here making this element transformation. This is render method. const themeProvider = theme => Component => props => (
<ThemeProvider theme={theme}>
<Component {...props} />
</ThemeProvider>
);
...
this.provideTheme = themeProvider(someTheme);
...
// Not sure whether this can make that issue?
return React.createElement(this.provideTheme(() => children)); |
Okay I did directly this in decorator and it didn't helped. return <ThemeProvider theme={this.theme}>{children}</ThemeProvider>; So seems to be really somewhere else. |
When I'm using addDecorator per each story it works! storiesOf('Component')
.addDecorator(themeProvider(theme))
.add('story', () => (
<Component {...props1} />
)); Any thoughts? |
@creaux I tried to reproduce with addDecorator(storyFn => <div style={{border: 'solid 10px navy'}} children={storyFn()} />); and it works fine for me. |
Hello @usulpro, thanks for reply. I have updated regarding issue which is at the moment permanent. Global decorator is not loaded only for JEST storyshots. I overwalked this issue by local decorator which is passthrough as empty function for storybook (as global decorator is working) but local is only loaded for storyshots in JEST environment. storiesOf('Component')
// For storybook passthrough function returning getStory()
// For jest HOC containing ThemeProvider encapsulation
.addDecorator(themeProvider(theme)))
.add('story', () => (
<Component {...props} />
)) Global provider still used but changed as I was bit unclear about element vs. component and how storybook handling it (that was reason of previous issue). Now it is clear and usage is following. class WithTheme extends Component {
...
render() {
...
return <ThemeProvider theme={this.theme}>{children}</ThemeProvider>;
}
} Version of storybook 3.1.8 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
I see you already trying to solve this issue here #879 but I experiencing maybe the same. I haven't digged into deeply but following code making issue.
Error is following...
I'm using
styled-components
which expecting that I will use with HOC from this is quiet straightforward that hoc is not able to gather context data properly.The text was updated successfully, but these errors were encountered: