-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Edit Post: Try displaying offline status through a useNetworkConnectivity()
hook
#59025
Draft
tyxla
wants to merge
6
commits into
trunk
Choose a base branch
from
try/offline-status
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
tyxla
added
[Status] Blocked
Used to indicate that a current effort isn't able to move forward
[Feature] Offline
Related to offline editing
[Package] Compose
/packages/compose
[Package] Edit Post
/packages/edit-post
[Type] Experimental
Experimental feature or API.
labels
Feb 14, 2024
Size Change: +183 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
Flaky tests detected in f7ded19. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7904623073
|
tyxla
force-pushed
the
try/offline-status
branch
from
July 15, 2024 15:52
f7ded19
to
a8bef42
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Offline
Related to offline editing
[Package] Compose
/packages/compose
[Package] Edit Post
/packages/edit-post
[Status] Blocked
Used to indicate that a current effort isn't able to move forward
[Type] Experimental
Experimental feature or API.
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.
What?
This PR suggests displaying an offline status if the user ends up being offline.
This is an experiment and is by no means finished or ready to merge.
DO NOT MERGE!
Why?
As we're starting to look into collaborative editing, we have to consider implementing proper offline support. While researching what we have in place, I spotted we already have an implementation of displaying online status for React Native:
useNetworkConnectivity()
hookwithNetworkConnectivity
HoC<OfflineStatus />
component.However, we don't have them for the web version. This PR experiments with adding them, as a first step towards better offline support for the editor.
We could afterwards do a bunch of stuff with this hook, like for example stop trying any requests if we know we're offline. Right now, if an autosave request fails, we suspect that the user is offline and render a warning, but that's not necessarily the case.
How?
We're introducing:
useNetworkConnectivity()
hook that utilizeswindow.navigator.onLine
andonline
andoffline
events. I'm also adding basic tests.OfflineStatus
component that will render an offline status if the user is offline. That component is mostly for presentational purposes, I'm not certain this is the best way or best place to notify the user that they're online. But we're using that component for demonstrating theuseNetworkConnectivity()
hook.We're also utilizing the
OfflineStatus
component in the post editor header.Testing Instructions
Testing Instructions for Keyboard
None
Screenshots or screencast