feat: trait state patching transformation

This commit is contained in:
cha0s 2019-04-10 21:01:58 -05:00
parent 78bfe22ee3
commit d66efaeb1f

View File

@ -44,11 +44,12 @@ export class Trait extends Synchronized {
return;
}
const stateKey = step.path.substr(1);
const value = this.transformPatchValue(stateKey, step.value);
if (stateKey in this.entity) {
this.entity[stateKey] = step.value;
this.entity[stateKey] = value;
}
else {
this.state = this.state.set(stateKey, step.value);
this.state = this.state.set(stateKey, value);
}
}
@ -59,6 +60,10 @@ export class Trait extends Synchronized {
};
}
transformPatchValue(key, value) {
return value;
}
static contextType() {
return {};
}