Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Jan 19, 2025
1 parent c2fd4ef commit 3680a42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
27 changes: 4 additions & 23 deletions frontend/controller/serviceworkers/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ 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}/`)
request = new Request(`${url.origin}${routerBase}/dashboard`)
request = new Request(`${url.origin}${routerBase}/`)
}
} catch (e) {
return
Expand All @@ -103,23 +104,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)
}
return fetch(event.request.clone?.() || request).then(async (response) => {
if (
// Save successful reponses
response.status >= 200 &&
Expand All @@ -136,23 +128,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
}

Expand Down
2 changes: 0 additions & 2 deletions frontend/views/pages/PendingApproval.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3680a42

Please sign in to comment.