diff --git a/src/core/finalize.ts b/src/core/finalize.ts index 82f4a728..d83c040a 100644 --- a/src/core/finalize.ts +++ b/src/core/finalize.ts @@ -133,7 +133,7 @@ function finalizeProperty( } else return } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts. - if (isDraftable(childValue) && !Object.isFrozen(childValue)) { + if (isDraftable(childValue) && !isFrozen(childValue)) { if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) { // optimization: if an object is not a draft, and we don't have to // deepfreeze everything, and we are sure that no drafts are left in the remaining object diff --git a/src/utils/common.ts b/src/utils/common.ts index c1259970..ab3d2623 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -180,7 +180,7 @@ export function shallowCopy(base: any) { } export function freeze(obj: any, deep: boolean): void { - if (Object.isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return + if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return if (getArchtype(obj) > 1 /* Map or Set */) { obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any }