feat: more intelligent trait state merging
This commit is contained in:
parent
a014a59e20
commit
c1e7db9ebf
|
@ -11,7 +11,17 @@ export class Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptStateChange(change) {
|
acceptStateChange(change) {
|
||||||
this.state = this.state.merge(change);
|
const undefinedProperties = {};
|
||||||
|
for (const key in change) {
|
||||||
|
const value = change[key];
|
||||||
|
if (key in this.entity) {
|
||||||
|
this.entity[key] = value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
undefinedProperties[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.state = this.state.merge(undefinedProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
actions() {
|
actions() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user