Skip to content
Myr

fix: make sure changing an undefined value to undefined is not picked up as change. Fixes #646

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by Michel Weststrate · parent 2697430 · Browse files · 2 files+26 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+26 added−1 removed

  • tests:+20 added−0 removed
  • other:+6 added−1 removed

2 files+26 added−1 removed

modified:__tests__/regressions.js+20 added
modified:src/core/proxy.ts+6 added-1 removed
137 unmodified lines
138 return true139 }140 state.assigned_[prop] = true141 if (!state.modified_) {142 if (is(value, peek(latest(state), prop)) && value !== undefined)142 // the last check is because we need to be able to distinguish setting a non-existig to undefined (which is a change)143 // from setting an existing property with value undefined to undefined (which is not a change)144 if (145 is(value, peek(latest(state), prop)) &&146 (value !== undefined || has(state.base_, prop))147 )148 return true149 prepareCopy(state)150 markChanged(state)151 }
110 unmodified lines