We're upgrading from v11.1.7 to v11.1.11, and got the aforementioned error.
Here's the minimal repro example that resembles our code:
import { produce } from "immer";
import _ from "lodash";
const baseState = [
{ title: "Learn Macroeconomics", done: false },
{ title: "Try Immer", done: false },
];
const nextState = produce(baseState, (draftState) => {
draftState.push({ title: "Tweet about it" });
draftState[1].done = true;
if (
_.isEqual(draftState, [
{ title: "Learn Macroeconomics", done: false },
{ title: "Try Immer", done: true },
{ title: "Tweet about it" },
])
) {
console.log("yay!");
}
});
console.log({ baseState, nextState });
It throws:
TypeError: 'get' on proxy: property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<Object>' but got '[object Object]')
at isPrototype (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:6475:54)
at baseKeys (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:3530:12)
at keys (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:13406:60)
at baseGetAllKeys (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:3099:20)
at getAllKeys (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:5947:14)
at equalObjects (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:5865:22)
at baseIsEqualDeep (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:3380:14)
at baseIsEqual (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:3321:14)
at equalArrays (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:5757:17)
at baseIsEqualDeep (/Users/Glenn/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/lodash.js:3361:13)
Just wanted to quickly confirm whether this is expected after v11.1.8...v11.1.9, and whether wrapping draftState with current is the right call here, i.e. current(draftState)? 🙏
We're upgrading from v11.1.7 to v11.1.11, and got the aforementioned error.
Here's the minimal repro example that resembles our code:
It throws:
Just wanted to quickly confirm whether this is expected after v11.1.8...v11.1.9, and whether wrapping
draftStatewithcurrentis the right call here, i.e.current(draftState)? 🙏