Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 8 tasks
sm1thana opened this issue Jul 12, 2024 · 3 comments
Open
1 of 8 tasks

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

sm1thana opened this issue Jul 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@sm1thana
Copy link

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
@sm1thana sm1thana added the bug Something isn't working label Jul 12, 2024
Copy link

m2-assistant bot commented Jul 12, 2024

Hi @sm1thana. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

@glo82145
Copy link
Collaborator

@adobe export issue to JIRA project PWA as Bug

@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/PWA-3362 is successfully created for this GitHub issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants