diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 768aff7a4e..3aa44d8f93 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -97,9 +97,9 @@ export default function dom( const condition = `${deps.map(dep => `changed.${dep}`).join(' || ')}`; - const statement = `if (@differs((state.${key} = @template.computed.${key}(${deps + const statement = `if (@differs(state.${key}, (state.${key} = @template.computed.${key}(${deps .map(dep => `state.${dep}`) - .join(', ')})), oldState.${key})) changed.${key} = true;`; + .join(', ')})))) changed.${key} = true;`; computationBuilder.addConditional(condition, statement); }); @@ -165,7 +165,7 @@ export default function dom( ? `@assign(@template.data(), options.data)` : `options.data || {}`}; ${generator.metaBindings} - ${computations.length && `this._recompute({ ${Array.from(computationDeps).map(dep => `${dep}: 1`).join(', ')} }, this._state, {});`} + ${computations.length && `this._recompute({ ${Array.from(computationDeps).map(dep => `${dep}: 1`).join(', ')} }, this._state);`} ${options.dev && Array.from(generator.expectedProperties).map( prop => @@ -303,7 +303,7 @@ export default function dom( `} ${computations.length ? deindent` - ${name}.prototype._recompute = function _recompute(changed, state, oldState) { + ${name}.prototype._recompute = function _recompute(changed, state) { ${computationBuilder} } ` : (!sharedPath && `${name}.prototype._recompute = @noop;`)} diff --git a/src/shared/index.js b/src/shared/index.js index dcc2895831..c2e14744f3 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -155,7 +155,7 @@ export function _set(newState) { if (!dirty) return; this._state = assign({}, oldState, newState); - this._recompute(changed, this._state, oldState, false); + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); this._fragment.update(changed, this._state);