-
Notifications
You must be signed in to change notification settings - Fork 36
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
Storybook preview hooks can only be called inside decorators and story functions. #38
Comments
I am also having this error. I am using... {
"@storybook/react": "^6.4.9",
"@react-theming/storybook-addon": "^1.1.3"
} I am using it with MUIv5 and I am defining my // preview.js
import { theme as OverallTheme } from '../src/theme';
import { createTheme } from '@mui/material/styles';
import { ThemeProvider } from '@mui/material';
import { withThemes } from '@react-theming/storybook-addon';
const providerFn = ({ theme, children }) => {
const muTheme = createTheme(theme);
return <ThemeProvider theme={muTheme}>{children}</ThemeProvider>;
};
export const decorators = [withThemes(null, [OverallTheme], { providerFn })];
export const parameters = { docs: { source: { type: 'code' } } }; |
Another one facing the same issue, any progress on this? |
No solution yet |
The plugin looks so nice but I cannot use it because of this issue. Any workaround that would help? |
@usulpro we could very much use your assistance |
@totszwai This addon is being maintained. Not sure TS definition is related to this issue, but anyway PRs with fixes are always welcomed |
Same problem here. From a preliminary look it seems that context is not being passed in like it is in other decorators. Anything that relies on storybook context, like |
could be related to this issue——storybookjs/storybook#12006 basically the decorator renders it like this: <>{providerFn({ theme, children })}</> making that internal react JSX the “root” of the story as far as Storybook is concerned. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am getting the following error when using this plugin.
I am using . . .
The text was updated successfully, but these errors were encountered: