This commit is contained in:
2020-08-20 11:44:32 +02:00
parent 4715fc1814
commit 6aceefeb2f
2891 changed files with 11239 additions and 347539 deletions

View File

@@ -124,6 +124,13 @@ function defineKey(prop, subprops, prototype, prefix, keys, options) {
}
});
Object.defineProperty(nested, '$__parent', {
enumerable: false,
configurable: true,
writable: false,
value: this
});
compile(subprops, nested, path, options);
this.$__.getters[path] = nested;
}
@@ -131,8 +138,10 @@ function defineKey(prop, subprops, prototype, prefix, keys, options) {
return this.$__.getters[path];
},
set: function(v) {
if (v instanceof Document) {
v = v.toObject({ transform: false });
if (v != null && v.$__isNested) {
// Convert top-level to POJO, but leave subdocs hydrated so `$set`
// can handle them. See gh-9293.
v = v.$__parent.get(path);
}
const doc = this.$__[scopeSymbol] || this;
doc.$set(path, v);