Skip to content
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

Story stuck/slow using specific configuration #17877

Open
yairEO opened this issue Apr 4, 2022 · 2 comments
Open

Story stuck/slow using specific configuration #17877

yairEO opened this issue Apr 4, 2022 · 2 comments

Comments

@yairEO
Copy link
Contributor

yairEO commented Apr 4, 2022

Describe the bug

It's difficult to articulate the problem, as it involves a mix of things to manifest itself, which is slowness of loading a story (long seconds), or a complete browser hang, where the tab must be forced to a close.

EVIDENCE.mp4

For some reason, this only happens for stories which are wrapped with:

const storyWrap = storyFn => (_, storyArgs) => storyFn(storyArgs)

storiesOf(...).add('Render slow', storyWrap(() => ...

And only with lots of JSX in some props property which is spread on the story's component:

storiesOf('issue', module).add('Render slow', storyWrap(() => {
	const props = {
        data: [...Array(100)].fill(<></>)  // filling an array with JSX syntax manifests the problem
    }
	
	return <Foo {...props}>slow</Foo>
}))

I've narrowed it down to @storybook/addon-essentials, which is a common addon collection, and within it
to the docs & controls addons. When both are disabled, this issue does not occur:

main.js

module.exports = {
    "stories": [
		"../stories/**/*.stories.mdx",
		"../stories/**/*.stories.@(js|jsx|ts|tsx)"
    ],
    "addons": [
		"@storybook/addon-links",
		"@storybook/addon-interactions",
		{
			name: '@storybook/addon-essentials',
			options: {
				docs: true,     // set to false to eliminate the issue
				controls: true, // set to false to eliminate the issue
				actions: true,
				backgrounds: true,
				viewport: true,
			}
		}
    ],
    "framework": "@storybook/react"
}

To Reproduce
👉 Please clone my (very simplified) repo

System

System:
  OS: Windows 10 10.0.19042
  CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  
Binaries:
  Node: 14.19.1 - ~\AppData\Local\Volta\tools\image\node\14.19.1\node.EXE
  Yarn: 3.2.0 - ~\AppData\Local\Volta\tools\image\yarn\1.22.18\bin\yarn.CMD
  npm: 8.1.2 - ~\AppData\Local\Volta\tools\image\npm\8.1.2\bin\npm.CMD

Browsers:
  Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.43)

npmPackages:
  @storybook/addon-actions: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/addon-docs: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/addon-essentials: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/addon-interactions: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/addon-links: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/react: ^6.5.0-alpha.55 => 6.5.0-alpha.55
  @storybook/testing-library: ^0.0.9 => 0.0.9

Additional context
Updated Storybook (and some other packages) for a large components repo (of my workplace),
and then I saw some stories caused the browser to hang completely. Took ~10 hours to narrow it down.

We have hundreds of stories wrapped with this (storyWrap) wrapper, so it's not that simple to make
an overall change, and also, it is very strange those mentioned addons are involved in the slowness.

@GiancarlosIO
Copy link

👀

@NotOgnaiser
Copy link

NotOgnaiser commented May 11, 2023

I have a similar issue where if i pass a ReactNode inside a object as a prop to a component that's being rendered , the story takes a while to render. (ex: <Label test={{ test: <div>Hello</div> }} /> the prop doesn't need to be used), i am also using the docs and controls addon but disabling them, doesn't seem to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants