Skip to content
Myr

Don't freeze symbolic props

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 e7983c4 · Browse files · 2 files+27 added−3 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+27 added−3 removed

  • tests:+24 added−0 removed
  • other:+3 added−3 removed

2 files+27 added−3 removed

modified:__tests__/frozen.js+24 added
218 unmodified lines
219 state2.ref.state.x++220 }).not.toThrow()221 expect(state2.ref.state.x).toBe(2)222 })223224 it("never freezes symbolic fields #590", () => {225 const component = {}226 const symbol = Symbol("test")227 Object.defineProperty(component, symbol, {228 value: {x: 1},229 enumerable: true,230 writable: true,231 configurable: true232 })233234 const state = {235 x: 1236 }237238 const state2 = produce(state, draft => {239 draft.ref = component240 })241242 expect(() => {243 state2.ref[symbol].x++244 }).not.toThrow()245 expect(state2.ref[symbol].x).toBe(2)246 })247 })248}
modified:src/utils/common.ts+3 added-3 removed