Service worker: the shell and the built assets are precached at install and the copy for the cache is cloned before the page reads the response (it was cloned too late and never stored, so an offline reload of the home-screen app failed); the cache is named after the build; starting the app offline raises the offline line at once
This commit is contained in:
1 parent
14c454f5c1
commit
b1d79d54c7
4 files changed
+76
-36
No files matched your search
@@ -550,7 +550,7 @@ export const useStore = create((set, get) => {
|
||||
await get().pullState()
|
||||
} catch (e) {
|
||||
if (e.status === 401) { await forgetRemote(); get().setGuest(true) }
|
||||
else get().setUser(remote.user) // offline — keep going from the last-synced local copy
|
||||
else { get().setUser(remote.user); setSync({ offline: true }) } // offline — keep going from the last-synced local copy
|
||||
}
|
||||
syncReminder(get().S)
|
||||
finishBoot()
|
||||
@@ -599,6 +599,9 @@ export const useStore = create((set, get) => {
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.status === 401) get().setUser(null)
|
||||
// Started without a network (a home-screen app reopened in the gym's basement): keep the
|
||||
// signed-in copy and say so from the first screen, not only after the first failed push.
|
||||
else if (isNetworkError(e) && get().user) setSync({ offline: true })
|
||||
}
|
||||
finishBoot()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user