-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Open
Description
Describe the bug
Same as #1548 - defaultViewport is not applied
To Reproduce
- Create two stories
- configure
defaultViewportfor one story - Sometimes (rarely)
defaultViewportwill be applied, but usually not.
System
@storybook/addon-essentials: ^6.3.1 => 6.3.1
@storybook/addons: ^6.1.21 => 6.3.2
@storybook/react: ^6.3.1 => 6.3.1
Additional context
It's literally "not applied", something with useAddonState
https://github.com/storybookjs/storybook/blob/next/addons/viewport/src/Tool.tsx#L152-L160
useEffect(() => {
setState({
selected: // <-- called here
defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id),
isRotated: state.isRotated,
});
}, [defaultViewport]);
const { selected, isRotated } = state; // <--- not updated hereReactions are currently unavailable