-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Hello
I'm monkeypatching the store to freeze the result of store.getState() during development and I'm getting a weird error in only one connected component. The error is:
Uncaught TypeError: Cannot assign to read only property 'setWrappedInstance' of object '#<Connect>'
and it's happening on this line in connectAdvanced.js. What's the relation between getState() and connectAdvanced so that error is happening?
It's related for sure to freezing the state and also to connect the component, what I don't know if it's the main cause of it's an underlying problem that's being triggered by it. But if I remove one of both conditions (freezing the state or connecting the component) the problem goes away.
EDIT:
This is the monkeypatching code in case it provides more context:
if (process.env.NODE_ENV === 'development') {
const oldGetState = store.getState();
store.getState = () => deepFreeze(oldGetState());
}