vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
622 stars 166 forks source link

service worker keeps old icons in the browser even if new icons are present in the WAR file #6346

Open mvysny opened 5 years ago

mvysny commented 5 years ago

Vaadin 14, Java 8, Firefox 68.0.2

I've tried to play with Skeleton+PWA+Icons and there is a behavior I do not understand. The steps are as follows:

  1. I remove all service workers from Firefox
  2. I start Skeleton. Skeleton correctly shows the 'favicon' as "≡", the image is downloaded and the "transferred" in Firefox Network tab is "something 5kb"
  3. I press F5. The 'favicon' switches to a 'master chef cap', and the "transferred" now says "service worker". This is probably because the first PWA app I tried was the Bakery, and the PWA icon somehow persisted.

I'm running the test having Firefox Dev tools visible, with "Network / Disable Cache" checked.

There is a separate service worker cache, which survives even service worker deletion and/or application update. Deleting those image files from Firefox's Cache Storage removed the Chef Cap.

According to the Service Worker documentation: https://developers.google.com/web/ilt/pwa/caching-files-with-service-worker

You are responsible for implementing how your script (service worker) handles updates to the cache. All updates to items in the cache must be explicitly requested; items will not expire and must be deleted.

From that I judge we need to modify Vaadin service worker to update the icons somehow.

mvysny commented 5 years ago

This basically affects all productions which undergo the icon change e.g. because of rebranding.

ywuliu commented 5 years ago

Please resolved it ASAP

ywuliu commented 5 years ago

My problem relate to this one, it use "myconmapy" icon in local(MAC), but use "Vaadin Company Icon" in Linux Machine (Docker)

pleku commented 5 years ago

This might be a bug in workbox so we should probably look to updating it to a newer version, as the current one is at least a year old or so. Another alternative might be to try to force all the caches for the icons to be invalidated whenever there is a new production build done, but that seems quite excessive for something that workbox should able to handle for us.