[x] I documented the TypeScript code using JSDoc style.
[x] I added multiple screenshots/screencasts of my UI changes
[x] I translated all the newly inserted strings into German and English (NA)
Motivation and Context
In realtime collaboration, sometimes patches without any apparent conflict will result in cancellation of local changes on a client. This PR fixes this issue.
Description
In realtime collaboration, one client might be in the middle of making some changes while a patch to the diagram state is received from some remote. Upon receiving a patch, the patcher will apply the received patch to its own snapshot of the state, and then the reducer will set the local state to that patched state. If unsaved local changes are not synced with patcher's snapshot, the changes will be reverted.
This particularly happens a lot with continuous syncing (using .subscribeToAllModelChangePatches() method for realtime collaboration), as a stream of incoming patches will repeatedly cancel local changes the user is trying to do simultaneously. Note that the patcher's snapshot is intentionally kept behind local state to ensure small continuous changes don't result in patches not being sent enough (the patcher always sends the diffs with the last discrete changes).
This PR adds the option to update patcher's snapshot upon patching, and ensures the reducer will update the patcher's snapshot before merging the state with incoming patches. This solution will keep patcher's snapshot behind the local state to ensure sufficient emission of necessary patches, while resolving the issue at hand.
On Apollon_standalone, use continuous sync by ensuring .subscribeToAllModelChangePatches() method is used here,
Run two clients (ideally separate machines) working on the same diagram. The two clients should be able to smoothly change things at the same time without getting stuck.
This PR is stacked on top of #343
Checklist
I translated all the newly inserted strings into German and English(NA)Motivation and Context
In realtime collaboration, sometimes patches without any apparent conflict will result in cancellation of local changes on a client. This PR fixes this issue.
Description
In realtime collaboration, one client might be in the middle of making some changes while a patch to the diagram state is received from some remote. Upon receiving a patch, the patcher will apply the received patch to its own snapshot of the state, and then the reducer will set the local state to that patched state. If unsaved local changes are not synced with patcher's snapshot, the changes will be reverted.
This particularly happens a lot with continuous syncing (using
.subscribeToAllModelChangePatches()
method for realtime collaboration), as a stream of incoming patches will repeatedly cancel local changes the user is trying to do simultaneously. Note that the patcher's snapshot is intentionally kept behind local state to ensure small continuous changes don't result in patches not being sent enough (the patcher always sends the diffs with the last discrete changes).This PR adds the option to update patcher's snapshot upon patching, and ensures the reducer will update the patcher's snapshot before merging the state with incoming patches. This solution will keep patcher's snapshot behind the local state to ensure sufficient emission of necessary patches, while resolving the issue at hand.
Steps for Testing
.subscribeToAllModelChangePatches()
method is used here,Test Coverage
Screenshots