Skip to content

Commit

Permalink
Flow error (#2625)
Browse files Browse the repository at this point in the history
* Fix #2616. Wait until Chelonia is ready before logging in

* Feedback

* Fixes

* Fix #2623
  • Loading branch information
corrideat authored Feb 13, 2025
1 parent c1da0fd commit 7ce476f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ async function startApp () {
// Wait for SW to be ready
console.debug('[app] Waiting for SW to be ready')
return Promise.race([
navigator.serviceWorker.ready,
navigator.serviceWorker?.ready,
new Promise((resolve, reject) => setTimeout(() => reject(new Error('SW ready timeout')), 10000))
]).catch(e => {
console.error('[app] Service worker failed to become ready:', e)
Expand All @@ -380,6 +380,8 @@ async function startApp () {
removeHandler()
await sbp('chelonia/contract/wait', identityContractID)
}).then(() => {
// We know that `navigator.serviceWorker` is defined, since we've used
// it. This may need to be checked if a non-SW version is also supported.
const sw = ((navigator.serviceWorker: any): ServiceWorkerContainer)
const onready = () => {
this.ephemeral.ready = true
Expand Down

0 comments on commit 7ce476f

Please sign in to comment.