Skip to content

[bug]: Cached index.html at first load #4298

Closed
@sm1thana

Description

@sm1thana

Describe the bug
src/ServiceWorker/registerRoutes.js has rule for html files with NetworkFirst strategy:
/** * Route for HTML files. This route uses NetworkFirst strategy to fetch * the most up to date inlined data for the page. When offline, it will fallback * to the cache if available. */ registerRoute( ({ url, request }) => url.origin === self.location.origin && request.destination === 'document', new NetworkFirst() );

https://developer.chrome.com/docs/workbox/modules/workbox-strategies#network_first_network_falling_back_to_cache
It should try to fetch the latest response from the network. So we should get the latest index.html if we are online.

To reproduce
But if you will add some edits to venia's source code and open browser without reloading the page. You will see the old version. Browser will load new version only at the second loading.
It happens because index.html loads from SW cache (old version) and new version loads from network a little bit later. You can see it at venia.magento.com:
image

  • venia-concept
  • venia-ui
  • pwa-buildpack
  • peregrine
  • pwa-devdocs
  • upward-js
  • upward-spec
  • create-pwa

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions