mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
Moved registerShortcuts call within its own useEffect hook without any dep
This commit is contained in:
parent
8e45dbd361
commit
04dcfca97d
@ -145,13 +145,16 @@ export const ViewportTool: FunctionComponent = memo(
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
registerShortcuts(api, setState);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setState({
|
||||
selected:
|
||||
defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id),
|
||||
isRotated: state.isRotated,
|
||||
});
|
||||
registerShortcuts(api, setState);
|
||||
}, [defaultViewport]);
|
||||
|
||||
const { selected, isRotated } = state;
|
||||
|
Loading…
x
Reference in New Issue
Block a user