Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-50536] Add workaround for Dev Tools not opening correctly on Mac #2777

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/views/MattermostBrowserView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ export class MattermostBrowserView extends EventEmitter {
}

openDevTools = () => {
// Workaround for a bug with our Dev Tools on Mac
// For some reason if you open two Dev Tools windows and close the first one, it won't register the closing
// So what we do here is check to see if it's opened correctly and if not we reset it
if (process.platform === 'darwin') {
const timeout = setTimeout(() => {
if (this.browserView.webContents.isDevToolsOpened()) {
this.browserView.webContents.closeDevTools();
this.browserView.webContents.openDevTools({mode: 'detach'});
}
}, 500);
this.browserView.webContents.on('devtools-opened', () => {
clearTimeout(timeout);
});
}

this.browserView.webContents.openDevTools({mode: 'detach'});
}

Expand Down