Skip to content

Commit

Permalink
fix: Fixed regression in Object.frozen for IE11. Fixes #600
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Jun 24, 2020
1 parent d4b2def commit 6371d05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/finalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6371d05

Please sign in to comment.