diff --git a/frontend/controller/serviceworkers/cache.js b/frontend/controller/serviceworkers/cache.js index e7aa1a399..9c5df8f7b 100644 --- a/frontend/controller/serviceworkers/cache.js +++ b/frontend/controller/serviceworkers/cache.js @@ -35,7 +35,8 @@ if ( '/assets/images/pwa-icons/group-income-icon-maskable_192x192.png', '/assets/css/main.css', '/assets/js/main.js', - `${routerBase}/` + `${routerBase}/`, + `${routerBase}/dashboard` ]).catch(e => { console.error('Error adding initial entries to cache', e) }) @@ -90,8 +91,11 @@ if ( // If the route starts with `${routerBase}/`, use `${routerBase}/` as the // URL, since the HTML content is presumed to be the same. + // This is _crucial_ for the offline PWA to work, since currently the + // app uses different paths. if (url.pathname.startsWith(`${routerBase}/`)) { - console.error('@@@@XX rewriting request', url.pathname, `${url.origin}${routerBase}/`) + // For some reason, using just `${routerBase}/` breaks the tests, but + // `${routerBase}/dashboard` works. request = new Request(`${url.origin}${routerBase}/dashboard`) } } catch (e) { @@ -103,23 +107,14 @@ if ( return cache .match(request, { ignoreSearch: true, ignoreVary: true }) .then((cachedResponse) => { - if (request instanceof URL) { - console.error('@@@@XX', 106, request) - } if (cachedResponse) { // If we're offline, return the cached response, if it exists if (navigator.onLine === false) { - if (request instanceof URL) { - console.error('@@@@XX', 112, request, navigator.onLine) - } return cachedResponse } } return fetch(request.clone?.() || request).then(async (response) => { - if (request instanceof URL) { - console.error('@@@@XX', 120, request, response.status) - } if ( // Save successful reponses response.status >= 200 && @@ -136,23 +131,12 @@ if ( await cache.delete(request) } - if (request instanceof URL) { - console.error('@@@@XX', 139, request, response.status) - } - return response }).catch(e => { - if (request instanceof URL) { - console.error('@@@@XX', 145, request, e) - } - if (cachedResponse) { console.warn('Error while fetching', request, e) // If there was a network error fetching, return the cached // response, if it exists - if (request instanceof URL) { - console.error('@@@@XX', 153, request, e) - } return cachedResponse } diff --git a/frontend/views/pages/PendingApproval.vue b/frontend/views/pages/PendingApproval.vue index cffb58ceb..d05366078 100644 --- a/frontend/views/pages/PendingApproval.vue +++ b/frontend/views/pages/PendingApproval.vue @@ -68,8 +68,6 @@ export default ({ // side-effects. In general, UI elements should not be changing // non-ephemeral references. await sbp('chelonia/contract/retain', this.ephemeral.groupIdWhenMounted, { ephemeral: true }) - await sbp('okTurtles.eventQueue/queueEvent', 'event-handled', () => {}) - await new Promise(resolve => setTimeout(resolve, 200)) this.ephemeral.contractFinishedSyncing = true if (this.haveActiveGroupProfile) { this.ephemeral.groupJoined = true