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

Offline template misleading when server is down #177

Closed
iandunn opened this issue Jun 25, 2019 · 4 comments · Fixed by #190
Closed

Offline template misleading when server is down #177

iandunn opened this issue Jun 25, 2019 · 4 comments · Fixed by #190
Milestone

Comments

@iandunn
Copy link
Collaborator

iandunn commented Jun 25, 2019

  1. Visit wp-admin so that service worker is installed
  2. Stop nginx
  3. Refresh

You'll see:

You seem to be offline.

Please check your internet connection. In the future, this error screen could provide you with actions you can perform while offline, like edit recent drafts in Gutenberg.

That's misleading, because it makes the user think the problem is on their end, rather than the server's.

Off the top of my head, I'm not sure if it's practical to try and detect the difference, but I figured I'd mention it. I guess the browser could attempt an OPTIONS HTTP request to wordpress.org or something, as a quick way to test if the user is actually offline.

@westonruter
Copy link
Collaborator

Humm. I should think rather that an error template should be used here rather than the offline template. I presume the admin request is returning with a 0 status code?

@iandunn
Copy link
Collaborator Author

iandunn commented Jun 27, 2019

It's 200 for me.

Screen Shot 2019-06-27 at 4 36 55 PM

 

Screen Shot 2019-06-27 at 4 37 32 PM

@westonruter
Copy link
Collaborator

OK, I suppose this makes sense given how it is architected right now. When a fetch() fails due to the server not responding, there is no difference between whether you are offline or the server is offline.

So I think the simple fix is to check for navigator.onLine when the request fails. If it is true then we know it is actually the server that is offline (probably) and we can show a message related to that; otherwise, if it is false then we know the user is offline and we can show the same message as we do presently.

@westonruter
Copy link
Collaborator

Proposed fix in #190.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants