remove oldState from recompute

pull/856/head
Rich Harris 7 years ago
parent 955354739f
commit 6f0961ed5a

@ -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;`)}

@ -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);

Loading…
Cancel
Save