-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Component in object prop freezes the story #17720
Comments
we are also experiencing this issue |
Note, we're also seeing huge story freezes. Up to 40 seconds for a single story. For us, it wasn't related to component args. Changing from this: // Simplified
const Template: Story = (args) => (
<OurComponent args={args} />
)
export const Basic: Story<StoryProps> = Template.bind({})
Basic.args = args to this: export const Basic: Story<StoryProps> = () => (
<OurComponent args={args} />
) ...dropped the delay / render time from 40 seconds to zero!! |
For me, rendering the component outside the story helped: Hangs: export const Icons: Story<ButtonProps> = args => {
return (
<PropsTable
component={Button}
commonProps={args}
columnTitle={xProps => Object.keys(xProps)[0]}
xProps={[{ startIcon: <IconArrowRightArrowLeftHorizontalSMIcon /> }, { endIcon: <IconArrowRightArrowLeftHorizontalSMIcon /> }]}
yProps={[
{ size: "x-large" },
{ size: "large" },
{ size: "medium" },
{ size: "small" },
]}
/>
);
}; Works: const icon = <IconArrowRightArrowLeftHorizontalSMIcon />;
export const Icons: Story<ButtonProps> = args => {
return (
<PropsTable
component={Button}
commonProps={args}
columnTitle={xProps => Object.keys(xProps)[0]}
xProps={[{ startIcon: icon }, { endIcon: icon }]}
yProps={[
{ size: "x-large" },
{ size: "large" },
{ size: "medium" },
{ size: "small" },
]}
/>
);
}; |
@matthew-dean removing the story args like this fixed the issue
But this is really undesirable behaviour 😢 |
Does up upgrading to the latest 7.0 prerelease fix this? Migration guide: https://storybook.js.org/migration-guides/7.0 |
I noticed that the JSX rendering code sometimes gets stuck in an infinite recursion loop. If you add this to preview.jsx does the problem go away? export const parameters = {
docs: {
source: {
// any non-empty string here will skip jsx rendering, see:
// https://github.com/storybookjs/storybook/blob/next/code/renderers/react/src/docs/jsxDecorator.tsx#L165
code: "hello world",
},
},
}; |
@codebutler This worked for me. Thanks! |
If you're using 7.0 you can disable per story like so: export const MyStory: StoryObj<typeof Component> = {
render: (args) => {
return (
<>
<Component
{...args}
slots={{
prefix: <SearchIcon />
}}
/>
</>
);
},
parameters: {
docs: {
source: {
code: "disabled"
}
}
}
}; |
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
Bump: this still causes a hang on v7.5.1. Reopened as #19575 |
It worked for me, too. Thanks. |
@codebutler I'm worried if my question bothers you. |
Describe the bug
Component in object prop freezes the story. If I provide an object prop like this:
The component is not rendered or renders really slow. Also the actions don't work. The following component renders as expected:
To Reproduce
Clone the repro -> npm install -> npm run storybook -> change text in action of
DoesNotWorkButton
storySystem
Additional context
This pattern used to work in previous versions of Storybook. When
'@storybook/addon-docs'
is not used, everything works as expected.The text was updated successfully, but these errors were encountered: