Skip to content

Commit

Permalink
dev: fix react dev tools not showing due to upstream error
Browse files Browse the repository at this point in the history
  • Loading branch information
sfadschm committed Jan 26, 2025
1 parent 5e00fe9 commit 4ebbebe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main-process/app-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main-process/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4ebbebe

Please sign in to comment.