-
Notifications
You must be signed in to change notification settings - Fork 25
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
Initial support for tracking / applying patches #318
Conversation
@loreanvictor Could you run prettier on the files? The build step seems to complain about that 🤔 |
The code itself looks fine, I think the implementation is done nicely! If you could just have a look at the prettier issue and the few things codacy complains about the PR would be good to go! :) |
Thanks, I did fix styling issues with prettier and codacy, and added docs both for external APIs and the patcher service itself. |
With these adaptions in place, the change looks good to me 👍 |
Checklist
I translated all the newly inserted strings into German and English(NA)Motivation and Context
API Users of
ApollonEditor
can get notified when the diagram state changes, but they can't get notified of exactly what has changed. In the same vein, they can change the diagram whole-sale, but they can't apply patches to partially modify the diagram (without changing it all).These limitations can be particularly problematic in contexts such as realtime collaboration, as with the current APIs clients can sync the diagram whole-sale, which is error-prone and taxing on bandwidth.
Description
This PR adds the following methods to
ApollonEditor
class:Additionally, it adds the following components, all contained in
main/services/patcher
package:Keeps track of some given object, notifying subscribers of patches when some change happens, and applying incoming patches to the object.
Creates a Redux reducer to allow applying patches via action dispatch on the store.
Creates a Redux middleware to intercept changes to the state using the patcher.
A redux saga to correct layouts after applying a patch.
The format of the patch objects is according to JSONPatch spec.
Steps for Testing
/diagrams
folder,Test Coverage
Screenshots
The changes do not modify the UI, but they would look like the following (for example, testing via Apollon_standalone):