Skip to content

Commit fa862c0

Browse files
committed
Don't open window if app is not ready
1 parent 04dbcc7 commit fa862c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/electron/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function applyMenuTemplate(template: MenuItemConstructorOptions[]) {
1515
}
1616

1717
const mac = process.platform === 'darwin'
18+
let ready = false
1819

1920
const singleInstance = app.requestSingleInstanceLock()
2021
if (!singleInstance) {
@@ -66,12 +67,15 @@ app.on('activate', () => {
6667
firstWindow.show()
6768
firstWindow.focus()
6869
} else {
69-
createAWindow(electronFrontendUrl)
70+
if (ready) {
71+
createAWindow(electronFrontendUrl)
72+
}
7073
}
7174
})
7275

7376
// create main BrowserWindow when electron is ready
7477
app.on('ready', () => {
78+
ready = true
7579
createAWindow(
7680
`${electronFrontendUrl}?url=${encodeURIComponent(
7781
`${process.env.BOOST_HUB_BASE_URL!}/desktop?desktop-init=true`

0 commit comments

Comments
 (0)