feat: group api for UndoManager#720
Merged
Merged
Conversation
UndoManagerUndoManager
zxch3n
requested changes
May 17, 2025
zxch3n
reviewed
May 20, 2025
zxch3n
approved these changes
May 20, 2025
* docs: add intro for loro-inspector * docs: refine structure
* ci: fix * ci: use the right install command
- Surface the undo_stack and redo_stack depths - Add undo_count() and redo_count() checks to unit tests
* refactor: hide tracing logs behind 'logging' feature * fix: grammar err
* feat: add redact to wasm - Implemented `redact_json_updates` function to redact sensitive content in JSON updates. - Added tests for `redactJsonUpdates` to ensure sensitive content is properly redacted.
This was referenced May 20, 2025
Merged
This file contains hidden or 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
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.
Adds a new api to
UndoManagerto support grouping together changes into ideally one undo item.UndoManager::group_start(): will start a new group of changes, all subsequent changes will be merged into a new item on the undo stack. If we receive remote changes, we determine wether or not they are conflicting. If the remote changes are conflicting we split the undo item and close the group. If there are no conflict in changed container ids we continue the group merge.UndoManager::group_end(): ends the current group, callingUndoManager::undo()after this will undo all changes that occurred during the group.ContainerID's from the remote import and the last item on the undo stack, if there is no overlap we deem it safe to continue merging into the last undo item regardless of the remote import. If there are conflicts it behaves as it did previously.Example usage from tests: