refactor: StateSynchronizer no longer does diff

This commit is contained in:
cha0s 2019-04-07 15:59:04 -04:00
parent b41118953f
commit 2002911505
2 changed files with 1 additions and 19 deletions

View File

@ -5,7 +5,6 @@
"author": "cha0s",
"license": "MIT",
"dependencies": {
"immutable": "4.0.0-rc.12",
"immutablediff": "0.4.4"
"immutable": "4.0.0-rc.12"
}
}

View File

@ -1,5 +1,4 @@
import * as I from 'immutable';
import immutablediff from 'immutablediff';
export class StateSynchronizer {
@ -9,18 +8,6 @@ export class StateSynchronizer {
this.tick();
}
diff(previousState) {
// Take a pure JS diff.
const steps = immutablediff(
previousState,
this._state
).toJS();
if (0 === steps.length) {
return undefined;
}
return steps;
}
static nextStep(step) {
const {path, op, value} = step;
const parts = path.split('/');
@ -33,10 +20,6 @@ export class StateSynchronizer {
}];
}
static isStepUpdate(step) {
return -1 !== ['add', 'replace'].indexOf(step.op);
}
patchState(patch) {
const stepMap = {};
for (const {op, path, value} of patch) {