Bug #1211 When click Open Devtools turns already-opened devtools white

This commit is contained in:
TankistPro 2024-04-06 23:54:00 +03:00
parent e32d1c309a
commit 0b87dd750e

View file

@ -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
@ -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) => {