ilan-schemoul / meteor-service-worker

An universal service worker for meteor apps
MIT License
137 stars 26 forks source link

Page constantly reloading #5

Closed sandrich closed 7 years ago

sandrich commented 7 years ago

Hi

If I activate service-workers the page starts to reload as soon as it is loaded. It will do it in an endless loop until I unregister the service worker in my developer tools.

ilan-schemoul commented 7 years ago

I don't have such problem but here's some clue to try to understand what's wrong : did you check that you correctly copied the code, did you tried on another clean meteor project, did you tried on another browser, did you clear caches of your browser ?

sandrich commented 7 years ago

I have not checked with a clean project. It happens on my Mac and on my Mobile. You can try it yourself at https://dev.caveconditions.com. wonder if you see the same behaviour.

sandrich commented 7 years ago

Nevermind... Clearing all browser data cache seemed to have helped. Tested it now on various browsers and computers.

Thanks for the hint.

ilan-schemoul commented 7 years ago

Okay I'm glad your issue is solved ;) Maybe for some reasons an old HTML was always returned so Meteor were refreshing as it see that the hash of the JS/CSS was too old but as the CSS/JS hash were still not up to date Meteor kept refreshing.

fede-rodes commented 6 years ago

Hey @NitroBAY thanks for this service worker :)

I'm also experiencing this issue in development (and sometimes also in productions). It happens when I introduce some changes and the cache storage surpasses 5MB aprox

https://youtu.be/T3r1Nu01rgI

Here is the project I'm building with your service worker in case you want to take a look: https://github.com/fede-rodes/meteor-apollo-starter-kit

fede-rodes commented 6 years ago

@NitroBAY I think this happens every time I introduce changes in my app but don't update the version number at https://github.com/NitroBAY/meteor-service-worker/blob/master/sw.js#L2

Once the version is updated, the new service worker gets activated and the app behaves normally. It would be nice if we could set the version number based on the served file hashes. I guess for this we need to play with the Meteor build tool :/