Skip to content
Myr

Fixing #472 (In proxy, Frozen Maps#get() values don't become draft)

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

authored by Ori Livni · committed by Ori Livni · parent b2cef50 · Browse files · 2 files+32 added−2 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+32 added−2 removed

  • tests:+23 added−0 removed
  • other:+9 added−2 removed

2 files+32 added−2 removed

modified:__tests__/frozen.js+23 added
modified:src/proxy.js+9 added-2 removed
240 unmodified lines
241 const value = receiver.get(key)242 cb.call(thisArg, value, key, map)243 }),244 get: state => key => {245 const drafts = state[state.modified ? "copy" : "drafts"]245 const drafts = state.modified ? state.copy : state.drafts246247 if (drafts.has(key)) {247 return drafts.get(key)248 const value = drafts.get(key)249250 if (isDraft(value) || !isDraftable(value)) return value251252 const draft = createProxy(value, state)253 drafts.set(key, draft)254 return draft255 }256257 const value = latest(state).get(key)258 if (state.finalized || !isDraftable(value)) {
116 unmodified lines