Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): pre-warm offline shell under SHELL_KEY, not the request URL

[._.]/ Adam Eivyc82ecc7f518e
diff --git a/client/public/sw.js b/client/public/sw.js
index fa5a0a40a7..c2f5b4650a 100644
--- a/client/public/sw.js
+++ b/client/public/sw.js
@@ -58,12 +58,19 @@ self.addEventListener('install', (event) => {
// its in-memory JS, and its next navigation re-fetches the fresh shell.
self.skipWaiting();
event.waitUntil(
- caches.open(SHELL_CACHE).then((cache) =>
- // Pre-warm the shell so the very first offline navigation works even if
- // the user never revisited "/" online. Best-effort — a failure here must
- // not abort activation.
- cache.add(new Request('/', { cache: 'reload' })).catch(() => {})
- )
+ (async () => {
+ // Pre-warm the shell under the stable SHELL_KEY (NOT the request URL) so
+ // the very first offline navigation — including a deep-link reload —
+ // works even if the user never made an online navigation through the SW.
+ // navigationHandler reads the offline fallback from SHELL_KEY, so the
+ // pre-warm must write the same key (cache.add would key it by "/" and the
+ // fallback would miss). Best-effort — a failure must not abort install.
+ const response = await fetch(new Request('/', { cache: 'reload' })).catch(() => null);
+ if (response && response.ok) {
+ const cache = await caches.open(SHELL_CACHE);
+ await cache.put(SHELL_KEY, response);
+ }
+ })()
);
});