Conversation
…edPathsSnapshot()`, `$clearModifiedPaths()` Fix #14268
hasezoey
reviewed
Jul 2, 2024
Collaborator
hasezoey
left a comment
There was a problem hiding this comment.
LGTM, some minor suggestions
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
hasezoey
reviewed
Jul 3, 2024
Comment on lines
+217
to
+224
| * The function profile can look like: | ||
| * this.forEach(state1, fn); // iterates over all paths in state1 | ||
| * this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2 | ||
| * this.forEach(fn); // iterates over all paths in all states | ||
| * | ||
| * @param {String} [state] | ||
| * @param {String} [state] | ||
| * @param {Function} callback |
Collaborator
There was a problem hiding this comment.
Suggested change
| * The function profile can look like: | |
| * this.forEach(state1, fn); // iterates over all paths in state1 | |
| * this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2 | |
| * this.forEach(fn); // iterates over all paths in all states | |
| * | |
| * @param {String} [state] | |
| * @param {String} [state] | |
| * @param {Function} callback |
from what i can still tell, this function does not take any arugments, does it? (also the documented code above has no relation to this function
vkarpov15
added a commit
that referenced
this pull request
Jul 14, 2024
This was referenced Jul 30, 2024
This was referenced Jul 30, 2024
This was referenced Aug 29, 2024
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.
Fix #14268
Summary
$createModifiedPathsSnapshot()takes a snapshot of the document's current change tracking state, without modifying the document's properties.$restoreModifiedPathsSnapshot()restores the document's change tracking state to a given snapshot.Primarily useful for custom transaction wrappers like #14268. When you modify a document in a transaction and that document was created outside of the transaction, you may need to restore the document's change tracking state if the transaction was aborted.
As part of making this work, I also moved
Model.prototype.$__deltaand supporting code toDocument.prototype.$__delta. Otherwise,getChanges()crashes on subdocuments because subdocuments don't have a$__deltafunction.Examples