Skip to content
Myr

fix: make plugin loading idempotent, fixes #692

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 8808065 · Browse files · 2 files+17 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+17 added−2 removed

  • tests:+16 added−1 removed
  • other:+1 added−1 removed

2 files+17 added−2 removed

modified:__tests__/map-set.js+16 added-1 removed
3 unmodified lines
4 nothing,5 original,6 isDraft,7 immerable,8 enableAllPlugins8 enableAllPlugins,9 enableMapSet10} from "../src/immer"11import {each, shallowCopy, isEnumerable, DRAFT_STATE} from "../src/common"1213enableAllPlugins()
266 unmodified lines
280 draft.clear()281 })282 expect(result).toBe(set)283 })284285 test("#692 - idempotent plugin loading", () => {286 let mapType1287 produce(new Map(), draft => {288 mapType1 = draft.constructor289 })290291 enableMapSet()292 let mapType2293 produce(new Map(), draft => {294 mapType2 = draft.constructor295 })296 expect(mapType1).toBe(mapType2)297 })298 })299}
modified:src/utils/plugins.ts+1 added-1 removed