Skip to content

[Bug]: useState/useArgs in story is very laggy #24442

Open

Description

Describe the bug

A controlled component (using useState or useArgs) is laggy/sluggish/slow to update in storybook:

Screen.Recording.2023-10-11.at.17.08.09.mov

When opening the same story canvas in a new tab (aka iframe.html), it's smooth/fast as expected:

Screen.Recording.2023-10-11.at.17.08.42.mov

To our users it looks like our component is laggy, even though it's storybook that's laggy.

To Reproduce

Make a story that uses useState/useArgs for state management, and use a component that calls onChange frequently, such as a Slider component, or other component that calls onChange each time the mouse is moved. For example:

export const Default = {
  render: args => {
    const [value, setValue] = useState(0);
    return (
      <Slider {...args} value={value} onChange={value => setValue(value)} />
    );
  },
}

(let me know if a stackblitz repro is needed, and I'll make one)

System

System:
    OS: macOS 13.5
    CPU: (12) arm64 Apple M2 Pro
  Binaries:
    Node: 20.5.1 - /opt/homebrew/bin/node
    npm: 9.8.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 118.0.5993.70
    Safari: 16.6

Additional context

No response

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

Metadata

Assignees

Type

No type

Projects

  • Status

    Empathy Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions