refactor: selfEntity patch

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

View File

@ -183,8 +183,11 @@ function onMessage({type, payload}) {
switch (type) { switch (type) {
case 'state-update': case 'state-update':
const patch = unpacker.unpack(payload); const patch = unpacker.unpack(payload);
if (payload.selfEntity) { for (const step of patch) {
selfEntity = payload.selfEntity; const {op, path, value} = step;
if ('add' === op && '/selfEntity' === path) {
selfEntity = value;
}
} }
stateSynchronizer.patchState(patch); stateSynchronizer.patchState(patch);
dirty = true; dirty = true;