Skip to content

Commit

Permalink
Bug responsively-org#1211 When click Open Devtools turns already-open…
Browse files Browse the repository at this point in the history
…ed devtools white
  • Loading branch information
TankistPro committed Apr 6, 2024
1 parent e32d1c3 commit 0b87dd7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions desktop-app/src/renderer/components/Previewer/Device/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,15 @@ const Device = ({ isPrimary, device, setIndividualDevice }: Props) => {
return;
}
const webview = ref.current as Electron.WebviewTag;

if (webview == null) {
const isOpenedCurrentDevTool =
devtoolsOpenForWebviewId === webview.getWebContentsId();
if (webview == null || isOpenedCurrentDevTool) {
return;
}
if (!isOpenedCurrentDevTool && devtoolsOpenForWebviewId !== -1) {
await window.electron.ipcRenderer.invoke('close-devtools');
dispatch(setDevtoolsClose());
}
await window.electron.ipcRenderer.invoke<
OpenDevtoolsArgs,
OpenDevtoolsResult
Expand All @@ -217,7 +222,7 @@ const Device = ({ isPrimary, device, setIndividualDevice }: Props) => {
dockPosition,
});
dispatch(setDevtoolsOpen(webview.getWebContentsId()));
}, [dispatch, dockPosition]);
}, [devtoolsOpenForWebviewId, dispatch, dockPosition]);

const inspectElement = useCallback(
async (deviceX: number, deviceY: number) => {
Expand Down

0 comments on commit 0b87dd7

Please sign in to comment.