Skip to content

Commit

Permalink
fix: don't freeze drafts returned from produce if they were passed in…
Browse files Browse the repository at this point in the history
… as draft (#917)
  • Loading branch information
Alt-er authored Jan 15, 2023
1 parent 04c5fb3 commit 46867f8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/immerClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export class Immer implements ProducersFns {
// Only plain objects, arrays, and "immerable classes" are drafted.
if (isDraftable(base)) {
const scope = enterScope(this)
//when base is a draft,can't freeze
scope.canAutoFreeze_ = !isDraft(base)
const proxy = createProxy(this, base, undefined)
let hasError = true
try {
Expand Down

0 comments on commit 46867f8

Please sign in to comment.