-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[WEB-1322] dev: conflict free pages collaboration #4463
Merged
Merged
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
web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx
Outdated
Show resolved
Hide resolved
… into feat-pages-collaboration
…ne/plane into feat-pages-collaboration
…t-pages-collaboration
…t-pages-collaboration
SatishGandham
requested changes
May 21, 2024
SatishGandham
requested changes
May 21, 2024
SatishGandham
approved these changes
May 22, 2024
sriramveeraghanta
pushed a commit
that referenced
this pull request
May 27, 2024
* chore: pages realtime * chore: empty binary response * chore: added a ypy package * feat: pages collaboration * chore: update fetching logic * chore: degrade ypy version * chore: replace useEffect fetch logic with useSWR * chore: move all the update logic to the page store * refactor: remove react-hook-form * chore: save description_html as well * chore: migrate old data logic * fix: added description_binary as field name * fix: code cleanup * refactor: create separate hook to handle page description * fix: build errors * chore: combine updates instead of using the whole document * chore: removed ypy package * chore: added conflict resolving logic to the client side * chore: add a save changes button * chore: add read-only validation * chore: remove saving state information * chore: added permission class * chore: removed the migration file * chore: corrected the model field * chore: rename pageStore to page * chore: update collaboration provider * chore: add try catch to handle error --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
sriramveeraghanta
pushed a commit
that referenced
this pull request
May 28, 2024
* chore: pages realtime * chore: empty binary response * chore: added a ypy package * feat: pages collaboration * chore: update fetching logic * chore: degrade ypy version * chore: replace useEffect fetch logic with useSWR * chore: move all the update logic to the page store * refactor: remove react-hook-form * chore: save description_html as well * chore: migrate old data logic * fix: added description_binary as field name * fix: code cleanup * refactor: create separate hook to handle page description * fix: build errors * chore: combine updates instead of using the whole document * chore: removed ypy package * chore: added conflict resolving logic to the client side * chore: add a save changes button * chore: add read-only validation * chore: remove saving state information * chore: added permission class * chore: removed the migration file * chore: corrected the model field * chore: rename pageStore to page * chore: update collaboration provider * chore: add try catch to handle error --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
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's new?
Pages now support a conflict-free data merging along with OFFLINE editing.
Implementation
Added
yjs
to efficiently manage conflicts in pages. When on a page, new data gets fetched every 10 seconds and if there's anything new, the changes get merged without any conflicts with the local changes, removing the risk of data loss.Apart from this, along with the auto-save logic, users can now hit
Ctrl/Cmd + S
or click on theSave changes
button to save their data.Custom provider
Created a custom provider-
CollaborationProvider
to handle updates on the pagename
- Uniquely identifier for each page.document
- Actual YDoc to read from and write on.onChange
- Callback to handle updates.The main function of the provider is to handle updates on the document. All the updates performed in a time window of 2 seconds are merged using
mergeUpdates
fromyjs
and then theonChange
callback is triggered using this merge updates.IndexedDB for offline support
Added
y-indexeddb
to handle changes made when the client is offline, all of the updates made(online and offline) are stored in the indexedDB and on reconnecting, these changes are applied to the YDoc. These changes are then listened by theCollaborationProvider
which triggers theonChange
callback with these updates.Fixes- #1880
Plane issue: WEB-1322