refactor: StateSynchronizer no longer does diff
This commit is contained in:
parent
b41118953f
commit
2002911505
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user