immer - Uncaught TypeError: Cannot perform 'getPrototypeOf' on a proxy that has been revoked

139 Views Asked by At

I'm using immer in my codebase, a bit of code that appears to be totally valid immer is throwing this error: Uncaught TypeError: Cannot perform 'getPrototypeOf' on a proxy that has been revoked.

This is my code:

produce(obj, draft => {
    draft.field = produce(otherObj, otherDraft => {
         const {a} = draft
         if (a) {
             ...
             more non-immer code, other than assigning to draft/otherDraft
         }
     })
})

Is this possibly caused by nesting the produces? I'm having difficulty understanding the error or why I would be seeing it due to this code.

0

There are 0 best solutions below