Skip to content

Commit 79de932

Browse files
committed
Merge branch 'calibration-rework' into 'master'
Add network first for pages cache, add WASM cache See merge request glazdans/outlineapp!13
2 parents 1d18c70 + d9f7d99 commit 79de932

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

app/swCache.ts

+17-4
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ export const outlineAppCache: RuntimeCaching[] =
149149
],
150150
}),
151151
},
152+
{
153+
matcher: /\.(?:wasm)$/i,
154+
handler: new CacheFirst({
155+
cacheName: "static-wasm-assets",
156+
plugins: [
157+
new ExpirationPlugin({
158+
maxEntries: 48,
159+
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
160+
maxAgeFrom: "last-used",
161+
}),
162+
],
163+
}),
164+
},
152165
{
153166
matcher: /\.(?:css|less)$/i,
154167
handler: new CacheFirst({
@@ -226,7 +239,7 @@ export const outlineAppCache: RuntimeCaching[] =
226239
request.headers.get("Next-Router-Prefetch") === "1" &&
227240
sameOrigin &&
228241
!pathname.startsWith("/api/"),
229-
handler: new CacheFirst({
242+
handler: new NetworkFirst({
230243
cacheName: PAGES_CACHE_NAME.rscPrefetch,
231244
plugins: [
232245
new ExpirationPlugin({
@@ -241,7 +254,7 @@ export const outlineAppCache: RuntimeCaching[] =
241254
request.headers.get("RSC") === "1" &&
242255
sameOrigin &&
243256
!pathname.startsWith("/api/"),
244-
handler: new CacheFirst({
257+
handler: new NetworkFirst({
245258
cacheName: PAGES_CACHE_NAME.rsc,
246259
plugins: [
247260
new ExpirationPlugin({
@@ -256,7 +269,7 @@ export const outlineAppCache: RuntimeCaching[] =
256269
request.headers.get("Content-Type")?.includes("text/html") &&
257270
sameOrigin &&
258271
!pathname.startsWith("/api/"),
259-
handler: new CacheFirst({
272+
handler: new NetworkFirst({
260273
cacheName: PAGES_CACHE_NAME.html,
261274
plugins: [
262275
new ExpirationPlugin({
@@ -269,7 +282,7 @@ export const outlineAppCache: RuntimeCaching[] =
269282
{
270283
matcher: ({ url: { pathname }, sameOrigin }) =>
271284
sameOrigin && !pathname.startsWith("/api/"),
272-
handler: new CacheFirst({
285+
handler: new NetworkFirst({
273286
cacheName: "others",
274287
plugins: [
275288
new ExpirationPlugin({

0 commit comments

Comments
 (0)