Moved registerShortcuts call within its own useEffect hook without any dep

This commit is contained in:
Charles Gruenais 2021-04-19 22:09:34 +02:00
parent 8e45dbd361
commit 04dcfca97d

View File

@ -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;