From b1c6a8e884c48e115851ddf91b04c0a9c7ef3ade Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 24 Jul 2020 17:52:18 +0100 Subject: [PATCH] fix: made NOTHING and IMMERABLE shared symbols. Fixes #632 --- src/utils/env.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/env.ts b/src/utils/env.ts index 7d3306f8..c846d09a 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -20,7 +20,7 @@ export const isMinified = mini.name !== "mini" * The sentinel value returned by producers to replace the draft with undefined. */ export const NOTHING: Nothing = hasSymbol - ? Symbol("immer-nothing") + ? Symbol.for("immer-nothing") : ({["immer-nothing"]: true} as any) /** @@ -32,11 +32,11 @@ export const NOTHING: Nothing = hasSymbol * safe to mutate in a produce callback. */ export const DRAFTABLE: unique symbol = hasSymbol - ? Symbol("immer-draftable") + ? Symbol.for("immer-draftable") : ("__$immer_draftable" as any) export const DRAFT_STATE: unique symbol = hasSymbol - ? Symbol("immer-state") + ? Symbol.for("immer-state") : ("__$immer_state" as any) // Even a polyfilled Symbol might provide Symbol.iterator