From b3681a93eefec7f79d62281dd9433b78ab382d37 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 4 Aug 2024 18:05:03 +0800 Subject: [PATCH] Workbox expiration plugin not working as expected --- public/sw.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/public/sw.js b/public/sw.js index 71503729..738d95b4 100644 --- a/public/sw.js +++ b/public/sw.js @@ -96,24 +96,27 @@ const apiExtendedRoute = new RegExpRoute( ); registerRoute(apiExtendedRoute); -const apiIntermediateRoute = new RegExpRoute( - // Matches: - // - trends/* - // - timelines/link - /^https?:\/\/[^\/]+\/api\/v\d+\/(trends|timelines\/link)/, - new StaleWhileRevalidate({ - cacheName: 'api-intermediate', - plugins: [ - new ExpirationPlugin({ - maxAgeSeconds: 1 * 60, // 1min - }), - new CacheableResponsePlugin({ - statuses: [0, 200], - }), - ], - }), -); -registerRoute(apiIntermediateRoute); +// Note: expiration is not working as expected +// https://github.com/GoogleChrome/workbox/issues/3316 +// +// const apiIntermediateRoute = new RegExpRoute( +// // Matches: +// // - trends/* +// // - timelines/link +// /^https?:\/\/[^\/]+\/api\/v\d+\/(trends|timelines\/link)/, +// new StaleWhileRevalidate({ +// cacheName: 'api-intermediate', +// plugins: [ +// new ExpirationPlugin({ +// maxAgeSeconds: 1 * 60, // 1min +// }), +// new CacheableResponsePlugin({ +// statuses: [0, 200], +// }), +// ], +// }), +// ); +// registerRoute(apiIntermediateRoute); const apiRoute = new RegExpRoute( // Matches: