group-income
group-income copied to clipboard
"Error setting up service worker"
Problem
A whole bunch of service workers get registered, sometimes leading to a spinning Group Income icon while this code is running:
// register service-worker
await Promise.race(
[sbp('service-workers/setup'),
new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('Timed out setting up service worker'))
}, 15e3)
})]
).catch(e => {
console.error('[main] Error setting up service worker', e)
alert(L('Error while setting up service worker'))
throw e
})
Eventually it times out.
It seems like we're forgetting to unregister old service workers:
https://github.com/okTurtles/group-income/assets/138706/1a7a0f89-db50-4278-b37e-ecb650d00198
Solution
Figure out what's broken with our service worker setup that is causing this.
The screen recording above is on my Firefox Developer Edition tab that I use while testing grunt dev
during development, but this could theoretically happen on the production site too.