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

fix: throttle color controls and make updateArgs and resetArgs stable #18335

Merged
merged 2 commits into from
Jul 1, 2022

Conversation

Ang-YC
Copy link
Contributor

@Ang-YC Ang-YC commented May 26, 2022

Issue:

What I did

Fix a bug where Color controls are not throttled properly and causing sluggish preview

This is mainly caused by:

  • updateArgs and resetArgs is not stable (It depends on data / story which contains reference to args, so it is re-created everytime args is updated)
  • throttle for ColorControl is not called inside a memo function

To reproduce, go to this story https://storybookjs.netlify.app/official-storybook/?path=/story/addons-controls-sort--none and try to move around the color picker of the color control fast enough, the speed of re-rendering is too slow to catch up.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@nx-cloud
Copy link

nx-cloud bot commented May 26, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1ac9097. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very sensible thanks @Ang-YC. I think we can resolve the typing issues later.

lib/api/src/modules/stories.ts Outdated Show resolved Hide resolved
lib/api/src/modules/stories.ts Outdated Show resolved Hide resolved
@ndelangen ndelangen merged commit f749dd3 into storybookjs:next Jul 1, 2022
@ndelangen
Copy link
Member

Thank you for this PR @Ang-YC !!

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

Successfully merging this pull request may close these issues.

4 participants