From 6c4be4505466b715312b6b03eec43d6afd87424f Mon Sep 17 00:00:00 2001 From: darondel-yoobic Date: Fri, 30 Aug 2019 14:45:00 +0100 Subject: [PATCH] Fix defaultViewport in @addon-viewport --- addons/viewport/src/Tool.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/viewport/src/Tool.tsx b/addons/viewport/src/Tool.tsx index 999ccd40d42..66becf55791 100644 --- a/addons/viewport/src/Tool.tsx +++ b/addons/viewport/src/Tool.tsx @@ -133,6 +133,14 @@ export const ViewportTool: FunctionComponent<{}> = React.memo( }); const list = toList(viewports); + useEffect(() => { + setState({ + selected: + defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id), + isRotated: state.isRotated, + }); + }, [defaultViewport]); + const { selected, isRotated } = state; const item = list.find(i => i.id === selected) ||