Workbox caching pattern for WordPress admin section

When you add PWA to your WordPress site, you will notice that when editing your posts your pages will be cached and you will end up having to submit the page multiple times with no update on the front-end.

To fix this, I recommend adding NetworkOnly pattern to make sure your /wp-admin URL’s are not cached by your Workbox / PWA setup:

1
2
3
4
workbox.routing.registerRoute(
new RegExp('\/wp-admin*.*'),
new workbox.strategies.NetworkOnly()
);

 

Leave a Reply