make patching-induced rerenders stable #335
Merged
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.
Checklist
I added multiple screenshots/screencasts of my UI changes(NA)I translated all the newly inserted strings into German and English(NA)Motivation and Context
Currently in Apollon, when a patch is imported (via
.importPatch()
), it will result in all elements of the diagram being re-rendered (re-constructed from scratch), lowering performance and stability.Description
This PR introduces an option for
patcher-reducer
to accept custom merge functions for updating state (instead of the default naive solution of object assignment). It also adds a specific merge function forModelState
that merges two model states gracefully, maintaining instance references and diagram boundaries, and gracefully updating diagram metadata. As a result, the subsequent re-render of the diagram maintains all SVG elements and only updates / reconstructs what is necessary.Steps for Testing
data-x="42"
) to the element, and verifying that it still exists after the clients sync on the changes.Test Coverage