Skip to content

Commit 46867f8

Browse files
authored
fix: don't freeze drafts returned from produce if they were passed in as draft (#917)
1 parent 04c5fb3 commit 46867f8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/core/immerClass.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export class Immer implements ProducersFns {
8888
// Only plain objects, arrays, and "immerable classes" are drafted.
8989
if (isDraftable(base)) {
9090
const scope = enterScope(this)
91+
//when base is a draft,can't freeze
92+
scope.canAutoFreeze_ = !isDraft(base)
9193
const proxy = createProxy(this, base, undefined)
9294
let hasError = true
9395
try {

0 commit comments

Comments
 (0)