diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index f59ea0fe..08620f02 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -15,16 +15,17 @@ async function listenToEventIfNeeded(event: string): Promise { if (listening) { return await Promise.resolve(); } - return await appWindow - .listen(event, ({ payload }) => { - const handler = handlers.get(payload.id); - if (handler != null) { - handler(payload.progress, payload.total); - } - }) - .then(() => { - listening = true; - }); + + // We're not awaiting this Promise to prevent issues with Promise.all + // the listener will still be registered in time. + appWindow.listen(event, ({ payload }) => { + const handler = handlers.get(payload.id); + if (handler != null) { + handler(payload.progress, payload.total); + } + }); + + listening = true; } async function upload(