-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add page reloading in offline.php templates #697
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aec344d
Add page reloading in offline.php templates
thelovekesh 4245fa3
Add counter to delay reloading in each retry
thelovekesh 9f2e7c1
Update: Make fetch request to location.href instead of base origin
thelovekesh 3ad9e56
Add reloading script in offline and 500 templates and allow only on G…
thelovekesh 19b06c9
Add output control function
thelovekesh b8da05a
Add test for wp_service_worker_offline_page_reload
thelovekesh b80cd85
Remove output control functions
thelovekesh 661946f
Update test cases by adding output control function in output
thelovekesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to also do the reload in the case of server being down.
Also, something else that comes to mind: what happens if the error page is served in response to a POST request? If so, each reload will cause a re-POST message from the browser and that's probably not desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. For sure we need to check the method of the request. I have implemented these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As part of #728, I just realized that this check will never do anything:
pwa-wp/wp-includes/template.php
Lines 181 to 184 in 124baab
This is because the offline template is always fetched via a
GET
request by the service worker when it is installing, so it will never not beGET
. We need an alternative way of preventing the code from running on responses to non-GET requests.Contrary to what I thought above, each reload does not cause the browser re-POST message: #728 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I've addressed this via #763
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #763