Skip to content

Commit 327b47a

Browse files
committed
fix(subdocument): make subdocument#isModified use parent document's isModified
Fix #8223
1 parent 54db026 commit 327b47a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/types/subdocument.js

+10
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ Subdocument.prototype.markModified = function(path) {
115115
}
116116
};
117117

118+
Subdocument.prototype.isModified = function(paths, modifiedPaths) {
119+
if (this.$parent && this.$basePath) {
120+
paths = (Array.isArray(paths) ? paths : paths.split(' ')).
121+
map(p => [this.$basePath, p].join('.'));
122+
return this.$parent.isModified(paths, modifiedPaths);
123+
}
124+
125+
return Document.prototype.isModified(paths, modifiedPaths);
126+
};
127+
118128
/**
119129
* Marks a path as valid, removing existing validation errors.
120130
*

0 commit comments

Comments
 (0)