-
Notifications
You must be signed in to change notification settings - Fork 172
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
Baton Passing Basic Edition #4665
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
- Added `Baton Passing For Control` feature switch. - Add a call to release control of the projects to the existing `beforeunload` event listener. - Added `claimControlOverProject` and `releaseControl` calls to the server powered by `callCollaborationEndpoint`. - Added `allowedToEditProject` and associated hook function `useAllowedToEditProject`, to replace some existing functions like `useIsViewer`. - Added `currentlyHolderOfTheBaton` to `ProjectServerState`. - Updated `getProjectServerState` to call `claimControlOverProject`. - `ProjectServerStateUpdater` now defers to a new function `restartServerStateWatcher`, which updates on an interval if the appropriate feature flag is enabled. - Added `project_collaboration` table to the database. - Implemented `collaborationEndpoint` in the server to dispatch the various cases of collaboration request. - Extracted out some functions into `Utopia.Web.Endpoints.Common` module. - Added `ClaimCollaborationOwnership` and `ClearCollaboratorOwnership` cases to service types in the backend.
seanparsons
requested review from
gbalint,
Rheeseyb,
ruggi,
balazsbajorics,
liady and
bkrmendy
December 15, 2023 17:54
Job #9660: Bundle Size — 62.18MiB (+0.07%).
Warning Bundle contains 66 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
View job #9660 report View feature/baton-passing-basic branch activity |
ruggi
reviewed
Dec 15, 2023
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.
did a first pass and will re-pass, but it looks 🆗 to me!
ruggi
approved these changes
Dec 18, 2023
Rheeseyb
reviewed
Jan 2, 2024
Rheeseyb
reviewed
Jan 2, 2024
gbalint
approved these changes
Jan 2, 2024
Rheeseyb
reviewed
Jan 2, 2024
Rheeseyb
reviewed
Jan 2, 2024
Rheeseyb
reviewed
Jan 2, 2024
Rheeseyb
approved these changes
Jan 2, 2024
…nt handler change for releaseControl.
balazsbajorics
approved these changes
Jan 2, 2024
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.
Problem:
If a user opens the editor in multiple tabs they can end up in a nightmare scenario of different editors updating their own variant of the project and potentially work can be lost.
Fix:
This PR implements a first come-first served baton passing system of claiming ownership over the project. While there is no user interface for relinquishing or passing the baton actively to another user, closing the tab or not contacting the server for a period of over 20 seconds will result in control being released.
The underlying implementation is a simple database table containing the project ID and a collaboration editor ID, where the latter is generated by a client on startup and remains a secret to other editors.
Commit Details:
Baton Passing For Control
feature switch.beforeunload
event listener.claimControlOverProject
andreleaseControl
calls to the server powered bycallCollaborationEndpoint
.allowedToEditProject
and associated hook functionuseAllowedToEditProject
, to replace some existing functions likeuseIsViewer
.currentlyHolderOfTheBaton
toProjectServerState
.getProjectServerState
to callclaimControlOverProject
.ProjectServerStateUpdater
now defers to a new functionrestartServerStateWatcher
, which updates on an interval if the appropriate feature flag is enabled.project_collaboration
table to the database.collaborationEndpoint
in the server to dispatch the various cases of collaboration request.Utopia.Web.Endpoints.Common
module.ClaimCollaborationOwnership
andClearCollaboratorOwnership
cases to service types in the backend.