pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: Cached index.html at first load

Open sm1thana opened this issue 1 year ago • 3 comments

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
  • [x] pwa-buildpack
  • [ ] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

sm1thana avatar Jul 12 '24 13:07 sm1thana

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.

m2-assistant[bot] avatar Jul 12 '24 13:07 m2-assistant[bot]

@adobe export issue to JIRA project PWA as Bug

glo82145 avatar Sep 23 '24 08:09 glo82145

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

github-jira-sync-bot avatar Sep 23 '24 08:09 github-jira-sync-bot

Hi @sm1thana

Thank you for bringing this to our attention. We do think this could potentially be an issue related to how the service worker is handling index.html. However, we were unable to recreate this behavior on our local setup despite following the steps you described.

To help us investigate further, could you please provide more detailed steps or specific conditions under which this issue occurs? It would also be extremely helpful if you could share a screen recording of the steps leading to the issue, along with any relevant browser console logs or service worker registration details.

Looking forward to your response so we can address this effectively.

Thank you!

del15881 avatar Nov 21 '24 07:11 del15881

closing this ticket as per process since we waited for more then 2 weeks for reply, please feel free to reopen in csae isue still persist

glo42707 avatar Dec 06 '24 07:12 glo42707