Fix defaultViewport in @addon-viewport

This commit is contained in:
darondel-yoobic 2019-08-30 14:45:00 +01:00
parent 69af3ae2d3
commit 6c4be45054

View File

@ -133,6 +133,14 @@ export const ViewportTool: FunctionComponent<{}> = React.memo(
}); });
const list = toList(viewports); const list = toList(viewports);
useEffect(() => {
setState({
selected:
defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id),
isRotated: state.isRotated,
});
}, [defaultViewport]);
const { selected, isRotated } = state; const { selected, isRotated } = state;
const item = const item =
list.find(i => i.id === selected) || list.find(i => i.id === selected) ||