fix: precache __data.json for offline client-side navigation
All checks were successful
CI / update (push) Successful in 2m2s
All checks were successful
CI / update (push) Successful in 2m2s
The fitness pages were only precaching HTML shells, but SvelteKit client-side navigation fetches __data.json instead. Without these cached, navigating to workout/training while offline would fail.
This commit is contained in:
@@ -31,6 +31,9 @@
|
|||||||
];
|
];
|
||||||
const urls = slugs.map((s) => `/fitness/${s}`);
|
const urls = slugs.map((s) => `/fitness/${s}`);
|
||||||
navigator.serviceWorker.controller.postMessage({ type: 'CACHE_PAGES', urls });
|
navigator.serviceWorker.controller.postMessage({ type: 'CACHE_PAGES', urls });
|
||||||
|
// Also cache __data.json for client-side navigation
|
||||||
|
const dataUrls = slugs.map((s) => `/fitness/${s}/__data.json`);
|
||||||
|
navigator.serviceWorker.controller.postMessage({ type: 'CACHE_DATA', urls: dataUrls });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOnline() {
|
function onOnline() {
|
||||||
|
|||||||
Reference in New Issue
Block a user