immerjs / immer

Create the next immutable state by mutating the current one

Home Page:https://immerjs.github.io/immer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Cannot perform 'getPrototypeOf' on a proxy that has been revoked" error in simple reducer sandbox example.

laurencefass opened this issue Β· comments

πŸ› Bug Report

Ive created a very simple immer sandbox comparing immutable and mutable reducers by wrapping the mutable reducer (i.e. a reducer directly mutating state) in an immer produce function. The unwrapped (immutable) reducer works entirely correctly. The immer wrapped (mutable) reducer also updates state correctly but throws an error on attempting to execute console.log. I wrote this sandbox to prove a more complex example (too complex for a sanbox) causing a similar error, and I hope that fixing this will also fix my other issue.

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

This is the most basic reducer example I can think of so Im not sure whats going wrong, or if this is a bug.

Link to repro

https://codesandbox.io/s/react-typescript-forked-c2dc09

To Reproduce

Steps to reproduce the behavior:
run the code.
increment1 and note the console log works correctly
increment2 and note the repeated error

Observed behavior

see above

Expected behavior

console.log should work correctly inside the mutable reducer

Environment

We only accept bug reports against the latest Immer version.

  • Immer version:
  • [x ] I filed this report against the latest version of Immer
  • [x ] Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)

thanks for your time, that worked fine.