Replies: 1 comment 13 replies
-
That your JS/CSS files are directly served from the precache doesn't change at any time. It's actually your pages not being cached that causes this issue. To fix this, you have to cache your pages before they are visited. This can be done via Caching RSC responses may be a different story, though, as I haven't heard of a standard way to access the pages' RSC content. For example, in Next.js, statically generated pages have their RSC content dumped into You may also precache your pages, but that isn't recommended if they are dynamically generated as doing that causes them to always be served from the precache until the service worker is updated to not do so. |
Beta Was this translation helpful? Give feedback.
-
Hello! Thank you for providing a great framework for setting up a service worker!
I have gone through the precaching docs here but I would love some help in trying to leverage the precache into my current Next JS app for offline routing functionality
I noticed that the static js/css files for my dynamic layouts and pages are stored in the
serwist-precache-v2
cache (which is great!), but when I try navigating to a route that is not in therscPrefetch
orrsc
cache while offline, my browser redirects to the chrome-error pageI understand that when routing the react server component is fetched first, and then the static js and css files are fetched in order to load the page, but is there any way to handle this process of serving the static js and css files directly from the precache to perform an offline navigation?
Any help is greatly appreciated, and I would be more than happy to share my learnings with others as this seems to be a common use case of using serwist with Next JS. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions