Skip to content

Commit

Permalink
Don't open window if app is not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Rokt33r committed Nov 29, 2021
1 parent 04dbcc7 commit fa862c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/electron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function applyMenuTemplate(template: MenuItemConstructorOptions[]) {
}

const mac = process.platform === 'darwin'
let ready = false

const singleInstance = app.requestSingleInstanceLock()
if (!singleInstance) {
Expand Down Expand Up @@ -66,12 +67,15 @@ app.on('activate', () => {
firstWindow.show()
firstWindow.focus()
} else {
createAWindow(electronFrontendUrl)
if (ready) {
createAWindow(electronFrontendUrl)
}
}
})

// create main BrowserWindow when electron is ready
app.on('ready', () => {
ready = true
createAWindow(
`${electronFrontendUrl}?url=${encodeURIComponent(
`${process.env.BOOST_HUB_BASE_URL!}/desktop?desktop-init=true`
Expand Down

0 comments on commit fa862c0

Please sign in to comment.