vite-plugin-pwa icon indicating copy to clipboard operation
vite-plugin-pwa copied to clipboard

Expected behavior on React Router example

Open enguerranws opened this issue 1 year ago • 1 comments

Hi,

I'm not sure what is the expected behavior on React Router example. I run it using:

✔ Select a framework: › react
✔ Select a strategy: › generateSW
✔ Select a behavior: › Prompt for update
✔ Enable periodic SW updates? … yes
✔ Unregister SW? … yes

Then I go to https://localhost, the app is running fine, the SW is installed in the browser and activated. Then I edit a TSX file, which (as far as I know) rebuild the app and update the SW.

Using periodic SW updates, I expected that I would get the prompt after 20 secs max, but I don't see anything, I don't have any error in the console. Chrome is telling me that #12 is redundant when I refresh the browser.

What do I miss?

enguerranws avatar Nov 30 '23 16:11 enguerranws

Why are you unregistering the sw? you should enable it on last run (once tested, after first 2 runs):

  • run 1: react + generateSW + Prompt for update + Enable periodic SW updates (open page)
  • run 2: stop run 1, change TSX file then run examples cli again with same configuration in run 1, prompt should be shown
  • run3: stop run 2, and run examples cli again enabling Unregister SW, SW should be #<id> is redundant in dev tools

userquin avatar Nov 30 '23 17:11 userquin