Skip replacing annotations with unsaved local changes in setAnnotations()#184
Open
skalthoff wants to merge 1 commit intozotero:masterfrom
Open
Skip replacing annotations with unsaved local changes in setAnnotations()#184skalthoff wants to merge 1 commit intozotero:masterfrom
skalthoff wants to merge 1 commit intozotero:masterfrom
Conversation
…ns() When setAnnotations() receives annotations from the client side (e.g. during sync), it unconditionally replaces all matching annotation objects. If an annotation has unsaved local changes tracked in _unsavedAnnotations, this replacement triggers unnecessary re-renders due to broken reference identity, visually disrupting in-progress ink and image annotations. Skip annotations whose ID exists in _unsavedAnnotations, since the local version is authoritative until saved. This covers both locally modified annotations (non-null entries) and locally deleted annotations (null entries), preventing resurrection of deleted annotations. Fixes zotero#106
Member
|
@mrtcode: I think this looks OK, but could you take a look? |
Member
|
@skalthoff Should |
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.
Summary
setAnnotations()unconditionally replacing annotation objects that have unsaved local changes, causing unnecessary re-renders that visually disrupt in-progress ink/image annotations_unsavedAnnotations— the local version is authoritative until saved_unsavedAnnotations) from being resurrected by incoming updatesTest plan
setAnnotations()externally (e.g. via sync) — in-progress drawing should not be disrupted_unsavedAnnotationsstill render correctlysetAnnotations()callsFixes #106