Skip to content

Commit

Permalink
More SW fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed Mar 4, 2024
1 parent 55f7947 commit 703633c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ register('capabilities/buildmap', new StaleWhileRevalidate())
register('maps', new StaleWhileRevalidate())

try {
registerRoute(/\/$/, createHandlerBoundToURL('index.html'))
// Only catch requests to the root URL (a regex doesn't do this).
registerRoute(({ url }) => url.pathname.startsWith('/'), createHandlerBoundToURL('index.html'))
} catch (e) {
// This fails in dev as index.html is not in the manifest.
}
Expand Down

0 comments on commit 703633c

Please sign in to comment.