refactor: temporary jank

This commit is contained in:
cha0s 2019-04-05 23:50:24 -04:00
parent e0933ade6d
commit b63a15c8a4

View File

@ -12,11 +12,9 @@ export class Informed extends decorate(Trait) {
initialize() {
this.entityReducer = this.createIndexedReducer();
this._informState = I.fromJS({
// Let the client know who they are.
selfEntity: this.entity.instanceUuid,
});
this._informState = I.Map();
this._packer = new Packer();
this._sentSelf = false;
this._socket = undefined;
}
@ -111,6 +109,14 @@ export class Informed extends decorate(Trait) {
inform: (stateSynchronizer) => {
// Take diff.
let diff = stateSynchronizer.diff(this._informState);
if (!this._sentSelf) {
diff.unshift({
op: 'add',
path: '/selfEntity',
value: this.entity.instanceUuid,
});
this._sentSelf = true;
}
this._informState = stateSynchronizer.state;
// Emit!
if (diff) {