Only use enqueued scripts/style handles in revision to prevent endless reload if skip waiting enabled #187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 usestime()
as thever
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.