Skip to content

Commit

Permalink
fix: move precache route to reenable navigation handler on login redi…
Browse files Browse the repository at this point in the history
…rects [LIBS-473] (#809)
  • Loading branch information
KaiVandivier committed May 16, 2023
1 parent fa95d98 commit 1ff29b6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pwa/src/service-worker/set-up-service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export function setUpServiceWorker() {
// Includes all built assets and index.html
const precacheManifest = self.__WB_MANIFEST || []

// Same thing for built plugin assets
const pluginPrecacheManifest = self.__WB_PLUGIN_MANIFEST || []
precacheAndRoute(pluginPrecacheManifest)

// todo: also do this routing for plugin.html
// Extract index.html from the manifest to precache, then route
// in a custom way
Expand Down Expand Up @@ -126,6 +122,7 @@ export function setUpServiceWorker() {
return matchPrecache(indexUrl)
})
}
// NOTE: This route must come before any precacheAndRoute calls
registerRoute(navigationRouteMatcher, navigationRouteHandler)

// Handle the rest of files in the manifest - filter out index.html,
Expand All @@ -145,6 +142,10 @@ export function setUpServiceWorker() {
})
precacheAndRoute(restOfManifest)

// Same thing for built plugin assets
const pluginPrecacheManifest = self.__WB_PLUGIN_MANIFEST || []
precacheAndRoute(pluginPrecacheManifest)

// Similar to above; manifest injection from `workbox-build`
// Precaches all assets in the shell's build folder except in `static`
// (which CRA's workbox-webpack-plugin handle smartly).
Expand Down

0 comments on commit 1ff29b6

Please sign in to comment.