Skip to content

Commit

Permalink
Update the way a navigation route is registered
Browse files Browse the repository at this point in the history
The way a navigation route is registered changed in Workbox 5 (GoogleChrome/workbox#2095).
  • Loading branch information
delawski committed Aug 17, 2020
1 parent 2280295 commit 142e7ae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions wp-includes/js/service-worker-navigation-routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,15 @@ ERROR_OFFLINE_URL, ERROR_500_URL, NAVIGATION_DENYLIST_PATTERNS, ERROR_MESSAGES *
(pattern) => new RegExp(pattern)
);
if (navigationRouteEntry && navigationRouteEntry.url) {
wp.serviceWorker.routing.registerNavigationRoute(
navigationRouteEntry.url,
{
denylist,
}
wp.serviceWorker.routing.registerRoute(
new wp.serviceWorker.routing.NavigationRoute(
wp.serviceWorker.precaching.createHandlerBoundToURL(
navigationRouteEntry.url
),
{
denylist,
}
)
);

class FetchNavigationRoute extends wp.serviceWorker.routing.Route {
Expand Down

0 comments on commit 142e7ae

Please # to comment.