Skip to content
Myr

Initial finalize cleanup

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 c2d7617 · Browse files · 4 files+49 added−39 removed
This commit

State

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

Diff stats

4 files+49 added−39 removed

  • tests:+5 added−0 removed
  • other:+44 added−39 removed

4 files+49 added−39 removed

modified:__tests__/base.js+4 added
21 unmodified lines
2223runBaseTest("proxy (no freeze)", true, false)24runBaseTest("proxy (autofreeze)", true, true)25runBaseTest("proxy (autofreeze)(patch listener)", true, true, true)26// runBaseTest("proxy (patch listener)", true, ufalse, true)2728// TODO: no freeze + patch29runBaseTest("es5 (no freeze)", false, false)30runBaseTest("es5 (autofreeze)", false, true)31runBaseTest("es5 (autofreeze)(patch listener)", false, true, true)32// TODO: no freeze + patch3334function runBaseTest(name, useProxies, autoFreeze, useListener) {35 const listener = useListener ? function() {} : undefined36 const {produce, produceWithPatches} = createPatchedImmer({
2067 unmodified lines
modified:__tests__/frozen.js+1 added
21 unmodified lines
22 it("never freezes the base state", () => {23 const base = {arr: [1], obj: {a: 1}}24 const next = produce(base, draft => {25 draft.arr.push(1)26 debugger27 })28 expect(isFrozen(base)).toBeFalsy()29 expect(isFrozen(base.arr)).toBeFalsy()30 expect(isFrozen(next)).toBeTruthy()
185 unmodified lines
modified:src/finalize.ts+43 added-39 removed
modified:notes.txt+1 added
16 unmodified lines
17[ ] kill isEnumerable?18[ ] check todos19[ ] kill marchChangesSweep recursive if possible and no perf impact20[ ] todo try immer perf on really big tree21[ ] optimize each closures away?2223Import size report for immer:24┌───────────────────────┬───────────┬────────────┬───────────┐25│ (index) │ just this │ cumulative │ increment │
52 unmodified lines