Background
I am trying to use a navigationPreload and a cache data by StaleWhileRevalidate strategy for a navigation request.
Problem
I am getting an error message:
The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.
and cache is not updated
Finding
I think for this case this.waitUntil is missing to wait for a response
const response = await this.waitUntil(this.fetch(input));
|
const response = await this.fetch(input); |
Question
I am doing something wrong in my code or this finding is a needed fix?
navigationPreload.enable();
self.addEventListener('install', () => {
self.skipWaiting();
});
clientsClaim();
const routes = [
new RegExp(`/route1`),
new RegExp(`/route2`)
];
registerRoute(new NavigationRoute(new NetworkOnly(), {
denylist: routes,
}));
registerRoute(new NavigationRoute(new StaleWhileRevalidate({
cacheName: NAVIGATION_CACHE_NAME,
}), {
allowlist: routes,
}));
Thank you so much for creating this great library.
Background
I am trying to use a navigationPreload and a cache data by
StaleWhileRevalidatestrategy for a navigation request.Problem
I am getting an error message:
and cache is not updated
Finding
I think for this case
this.waitUntilis missing to wait for a responseworkbox/packages/workbox-strategies/src/StrategyHandler.ts
Line 240 in 0b5d9d8
Question
I am doing something wrong in my code or this finding is a needed fix?
Thank you so much for creating this great library.