File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,13 @@ workbox.routing.registerRoute(matchRuntimePath, async context => {
341341 const cacheName = getAPICacheName ( apiVersion )
342342 const cacheOptions = { ...runtimeCacheOptions , cacheName }
343343
344+ if ( event . request . cache === 'only-if-cached' && event . request . mode !== 'same-origin' ) {
345+ return
346+ }
347+
348+ if ( ! apiVersion ) {
349+ return new workbox . strategies . NetworkOnly ( ) . handle ( context )
350+ }
344351 // Check the cache for all routes. If the result is not found, get it from the network.
345352 return new workbox . strategies . CacheOnly ( cacheOptions )
346353 . handle ( context )
@@ -350,7 +357,7 @@ workbox.routing.registerRoute(matchRuntimePath, async context => {
350357 // 2. it provide that to client and server build as a webpack define
351358 // 3. we should monkey-patch xhr to send x-rsf-api-version as a request header on all requests
352359
353- if ( apiRes . headers . get ( 'x-rsf-cache-control' ) && apiVersion ) {
360+ if ( apiRes . headers . get ( 'x-rsf-cache-control' ) ) {
354361 const path = url . pathname
355362
356363 caches . open ( cacheName ) . then ( cache => {
You can’t perform that action at this time.
0 commit comments