From 4ebbebe56acb16c9c3bf59b0663a8c53ab51cda5 Mon Sep 17 00:00:00 2001 From: Alex Schmitz Date: Sun, 26 Jan 2025 00:59:49 +0100 Subject: [PATCH] dev: fix react dev tools not showing due to upstream error --- app/src/main-process/app-window.ts | 5 +++++ app/src/main-process/main.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts index 03a3d262431..566a4a30caa 100644 --- a/app/src/main-process/app-window.ts +++ b/app/src/main-process/app-window.ts @@ -252,6 +252,11 @@ export class AppWindow { this.window.restore() } + /** TODO: Remove if https://github.com/facebook/react/issues/27749 is fixed */ + public reload() { + this.window.reload() + } + public isFocused() { return this.window.isFocused() } diff --git a/app/src/main-process/main.ts b/app/src/main-process/main.ts index 438afb81f4f..f57814c23ed 100644 --- a/app/src/main-process/main.ts +++ b/app/src/main-process/main.ts @@ -770,6 +770,16 @@ function createWindow() { loadExtensionOptions: { allowFileAccess: true }, }) console.log('Added Extensions: "React Developer Tools", "axe DevTools"') + + // Reload the window to attach React Developer Tools + // See https://github.com/facebook/react/issues/27749 + // TODO: Remove when/if upstream is fixed + window.onDidLoad(() => { + setTimeout(() => { + window.reload() + console.log('Reloaded window to attach React Developer Tools.') + }, 1000) + }) } catch (e) { console.log('An error occurred while loading extensions: ', e) }