Refactoring day1

This commit is contained in:
2020-08-20 20:27:14 +02:00
parent 6aceefeb2f
commit b907489a75
481 changed files with 5321 additions and 5616 deletions

View File

@@ -124,13 +124,6 @@ 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;
}
@@ -138,10 +131,8 @@ function defineKey(prop, subprops, prototype, prefix, keys, options) {
return this.$__.getters[path];
},
set: function(v) {
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);
if (v instanceof Document) {
v = v.toObject({ transform: false });
}
const doc = this.$__[scopeSymbol] || this;
doc.$set(path, v);