Skip to content

Commit

Permalink
proof of concept for cleaning up dangling defaults on unmodified subd…
Browse files Browse the repository at this point in the history
…ocuments re: #14722
  • Loading branch information
vkarpov15 committed Jul 5, 2024
1 parent 446b923 commit c9f6591
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,13 @@ Document.prototype.$__set = function(pathToMark, path, options, constructing, pa
}
});
}
} else if (schema && schema.instance === 'Embedded') {
const defaultPaths = Object.keys(this.$__.activePaths.states['default'] ?? {});
for (const defaultPath of defaultPaths) {
if (defaultPath.startsWith(path + '.')) {
this.$__.activePaths.clearPath(defaultPath);
}
}
}

let obj = this._doc;
Expand Down

0 comments on commit c9f6591

Please sign in to comment.