Preload resources after service worker installation

When the service worker is registered for the first time, resources loaded
before it becomes active won't go through the service worker. These resources
may be served from the browser's HTTP cache on subsequent requests, bypassing
the service worker cache entirely.

The new `preload` option accepts a regex pattern. On first visit (when no
controller exists), it waits for the service worker to take control, then
sends a message with URLs from `performance.getEntriesByType("resource")`
that match the pattern. The service worker fetches and caches these resources.
This commit is contained in:
Rosa Gutierrez
2026-02-06 12:37:39 +01:00
parent b93808235c
commit 089fcf94f8
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ GIT
GIT
remote: https://github.com/hotwired/turbo-rails.git
revision: 0becdbbcdbf607eab6632463bc63f94d64249b7b
revision: ca62e8bdad88d01914d512ad24424e0670f239c9
branch: offline-cache
specs:
turbo-rails (2.0.23)