From 4ebfb544aa1aa476e660dd742ec8fe7aac3b7d67 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun <cheeaun@gmail.com>
Date: Sat, 3 Aug 2024 19:14:04 +0800
Subject: [PATCH] This caching seems still buggy

Revert to SWR with 1-min expiry
---
 public/sw.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/public/sw.js b/public/sw.js
index b1a95073..71503729 100644
--- a/public/sw.js
+++ b/public/sw.js
@@ -101,11 +101,11 @@ const apiIntermediateRoute = new RegExpRoute(
   // - trends/*
   // - timelines/link
   /^https?:\/\/[^\/]+\/api\/v\d+\/(trends|timelines\/link)/,
-  new CacheFirst({
+  new StaleWhileRevalidate({
     cacheName: 'api-intermediate',
     plugins: [
       new ExpirationPlugin({
-        maxAgeSeconds: 10 * 60, // 10 minutes
+        maxAgeSeconds: 1 * 60, // 1min
       }),
       new CacheableResponsePlugin({
         statuses: [0, 200],