Skip to content

Handling navigationPreload #136

Closed Answered by DuCanhGH
HugeLetters asked this question in Q&A
Apr 28, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

@HugeLetters yes, you may want to register a NavigationRoute rather than use setDefaultHandler in this case.

Looking at source code it seems like it gets preloadResponse gets discarded if there' no matched handler found.

You're right. If Serwist can't find a handler, the request would be treated as if there weren't a service worker intercepting it.

Edit: The Serwist class also provides the precacheOptions.navigateFallback option, so you don't have to use the lower level NavigationRoute class. Unless you don't use an app shell, or that shell is not precached, that is.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@DuCanhGH
Comment options

Answer selected by HugeLetters
@HugeLetters
Comment options

@DuCanhGH
Comment options

@HugeLetters
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants