diff --git a/app/views/service_worker/index.js.erb b/app/views/service_worker/index.js.erb index 8f3b55604..ad6582bbe 100644 --- a/app/views/service_worker/index.js.erb +++ b/app/views/service_worker/index.js.erb @@ -35,10 +35,20 @@ self.clients.claim(); }); + function includesUnsupportedPath(url) { + return [ + '/%F0%9F%92%B8', // 💸 (hiring) + '/admin', // Don't run on admin dashboard. + '/oauth/', // Skip oauth apps + '/onboarding', // Don't run on onboarding. + '/users/auth', // Don't run on authentication. + ].some(path => url.includes(path)) + } + self.addEventListener("fetch", (event) => { // We only want to call event.respondWith() if this is a navigation request - // for an HTML page. - if (event.request.mode === "navigate") { + // for an HTML page with a few exceptions. + if (event.request.mode === "navigate" && !includesUnsupportedPath(event.request.url)) { event.respondWith( (async () => { try { @@ -72,4 +82,4 @@ // event.respondWith(), the request will be handled by the browser as if there // were no service worker involvement. }); -<% end %> \ No newline at end of file +<% end %>