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

Only use enqueued scripts/style handles in revision to prevent endless reload if skip waiting enabled #187

Merged

Conversation

westonruter
Copy link
Collaborator

When skip-waiting is not disabled (which it is not by default) whenever the logic in the service worker changes in any way, the page is reloaded when the new service worker is installed. The offline and 500 error templates use the enqueued scripts/styles as part of the precache entry revision. The problem is that the revision was including the entire script/style dependency objects which include the ver. If a theme enqueues a script or style and uses time() as the ver then this will result in the service worker JS changing every time it is accessed, and thus the page will infinitely reload. This is known to be an issue with the Genesis Sample theme.

In reality only the list of handles should need to be included, so this change is applied here.

Fixes #183.

@westonruter westonruter added this to the 0.3 milestone Jul 3, 2019
@westonruter westonruter merged commit f7ba749 into master Jul 9, 2019
@westonruter westonruter deleted the fix/variable-dependency-version-infinite-reload branch July 9, 2019 22:24
@westonruter westonruter changed the title Only use enqueued scripts/style handles in revision Only use enqueued scripts/style handles in revision to prevent endless reload if skip waiting enabled Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite reload if skip waiting enabled when Genesis sample theme active
1 participant