diff --git a/lib/document.js b/lib/document.js index 179b1ce8dca..054707d9b81 100644 --- a/lib/document.js +++ b/lib/document.js @@ -2221,9 +2221,8 @@ Document.prototype.isModified = function(paths, modifiedPaths) { paths = paths.indexOf(' ') === -1 ? [paths] : paths.split(' '); } - const directModifiedPathsObj = this.$__.activePaths.getStatePaths('modify'); - const directModifiedPaths = Object.keys(directModifiedPathsObj); - if (directModifiedPaths.length === 0) { + const directModifiedPathsObj = this.$__.activePaths.states.modify; + if (directModifiedPathsObj == null) { return false; } for (const path of paths) { @@ -2237,6 +2236,7 @@ Document.prototype.isModified = function(paths, modifiedPaths) { return !!~modified.indexOf(path); }); + const directModifiedPaths = Object.keys(directModifiedPathsObj); return isModifiedChild || paths.some(function(path) { return directModifiedPaths.some(function(mod) { return mod === path || path.startsWith(mod + '.'); @@ -3324,10 +3324,7 @@ Document.prototype.$__reset = function reset() { let _this = this; // Skip for subdocuments - if (this.$isDocumentArrayElement || this.$isSingleNested) { - return this; - } - const subdocs = this.$getAllSubdocs(); + const subdocs = this.$parent() === this ? this.$getAllSubdocs() : []; const resetArrays = new Set(); for (const subdoc of subdocs) { const fullPathWithIndexes = subdoc.$__fullPathWithIndexes();