Improve collaborative editing in sync package#72040
Closed
chriszarate wants to merge 13 commits into
Closed
Conversation
…n a template for UUID-based awareness features to work
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 draft pull request extends and improves the collaborative editing experiment to provide:
core-datapackage retains control over which entity records are synced and how changes are merged.SyncProviderclass. This allows plugins to provide their own sync transports and to implement user-facing sync behaviors such as awareness / presence indicators.It is open now for discussion and guidance while we continue to improve it (see "How?" section).
Why?
This work builds on the pull request opened by @dmonad earlier this year. Our immediate goal is to provide a production-ready implementation of collaborative editing for WPVIP customers using a WebSocket transport.
Gutenberg's
syncpackage must be flexible enough to support a future "default" sync transport that ships with Gutenberg, while also allowing plugins to provide their own transport. Additionally, while collaborative editing is still under development, it must also provide ways for plugins to implement missing features such as awareness / presence indicators and CRDT persistence.Lastly, Gutenberg's
core-datapackage must provide stable and performant merge algorithms so that entity records are synced in a way that aligns with user expectations.How?
This pull request is large in service of providing a complete implementation for review. However, the commits are atomic by feature and can be reviewed one-by-one. If desired, we can split this PR up into smaller ones, with the understanding that the branches may not be in a fully functional state.
core-datastore with a "database" Yjs provider (IndexedDB), this change makes syncing a side-effect without changing how the entity records are represented and treated within the store. (Kevin's PR took the same approach.)syncpackage to be imported by plugins and other external code.SyncProviderto accept "handlers" fromcore-dataactions and resolvers that allow it to safely interact with the store.core.getSyncProviderfilter to allow plugins to extend theSyncProviderclass and provide custom sync transports.export { something } from './file').Additional props to @alecgeatches, @ingeniumed, and @pkevan for their contributions to this branch.
Testing Instructions
This PR can be tested in two ways:
admin-ajax.phpfor signaling and the initial connection is delayed.gutenberg.npm installnpm run devto start the development environment, including WebSocket server. See additional details and instructions, if needed.Testing Instructions for Keyboard
No UI changes in this pull request.
Screenshots or screencast
WebSocket provider with awareness / presence indicators (WPVIP plugin)
plugin2.mov