You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Upgrading from v6.2.0-beta.14 to v6.2.2, I've experienced that the new color control seems to work on initial load, but its input value get stuck when switching to other stories. Changing the color on other stories reflects on the initial story.
If you click the <> color format toggle button, the value will update and show on the current story, but it'll only update once; dragging around the color picker won't update it.
At any point when the Reset Controls button is clicked, it does reset the value and reflects on the component, but doesn't update the color control's input value.
To Reproduce
Steps to reproduce the behavior:
Go to a story and change the color with the color control. It works here.
Go to a different story and change it again. It doesn't work here.
Go back to the first story. The color you used on the other story will be used here.
Expected behavior
When switching stories (or clicking the Reset Controls button), the color control input should reset to a new initial value.
useState() takes an initial value and continues to use that value even on rerenders. I'm guessing that this causes the input to reference the state of only the first rendered story.
Describe the bug
Upgrading from v6.2.0-beta.14 to v6.2.2, I've experienced that the new color control seems to work on initial load, but its input value get stuck when switching to other stories. Changing the color on other stories reflects on the initial story.
If you click the
<>
color format toggle button, the value will update and show on the current story, but it'll only update once; dragging around the color picker won't update it.At any point when the Reset Controls button is clicked, it does reset the value and reflects on the component, but doesn't update the color control's input value.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When switching stories (or clicking the Reset Controls button), the color control input should reset to a new initial value.
Screenshots
Here's a screen recording: https://gfycat.com/EcstaticGiantGuernseycow
Code snippets
With a React component:
The story:
System
Additional context
Searching through the source code, I think these would be the relevant lines affecting this: https://github.com/storybookjs/storybook/blob/next/lib/components/src/controls/Color.tsx#L211-L213
useState()
takes an initial value and continues to use that value even on rerenders. I'm guessing that this causes the input to reference the state of only the first rendered story.┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: