this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move iconsRoute up

Should intercept first before 'assets'

+23 -21
+23 -21
public/sw.js
··· 12 12 13 13 self.__WB_DISABLE_DEV_LOGS = true; 14 14 15 + const iconsRoute = new Route( 16 + ({ request, sameOrigin }) => { 17 + const isIcon = request.url.includes('/icons/'); 18 + return sameOrigin && isIcon; 19 + }, 20 + new CacheFirst({ 21 + cacheName: 'icons', 22 + plugins: [ 23 + new ExpirationPlugin({ 24 + // Weirdly high maxEntries number, due to some old icons suddenly disappearing and not rendering 25 + // NOTE: Temporary fix 26 + maxEntries: 300, 27 + maxAgeSeconds: 3 * 24 * 60 * 60, // 3 days 28 + purgeOnQuotaError: true, 29 + }), 30 + new CacheableResponsePlugin({ 31 + statuses: [0, 200], 32 + }), 33 + ], 34 + }), 35 + ); 36 + registerRoute(iconsRoute); 37 + 15 38 const assetsRoute = new Route( 16 39 ({ request, sameOrigin }) => { 17 40 const isAsset = ··· 58 81 }), 59 82 ); 60 83 registerRoute(imageRoute); 61 - 62 - const iconsRoute = new Route( 63 - ({ request, sameOrigin }) => { 64 - const isIcon = request.url.includes('/icons/'); 65 - return sameOrigin && isIcon; 66 - }, 67 - new CacheFirst({ 68 - cacheName: 'icons', 69 - plugins: [ 70 - new ExpirationPlugin({ 71 - maxEntries: 300, 72 - maxAgeSeconds: 3 * 24 * 60 * 60, // 3 days 73 - purgeOnQuotaError: true, 74 - }), 75 - new CacheableResponsePlugin({ 76 - statuses: [0, 200], 77 - }), 78 - ], 79 - }), 80 - ); 81 - registerRoute(iconsRoute); 82 84 83 85 // 1-day cache for 84 86 // - /api/v1/custom_emojis