-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move ref context binding to fix object freezing middleware #733
Conversation
Except now it's creating a new bound function every render. I don't think we want to do this. |
LGTM. Thanks! |
Oh crap, I didn't follow that code all the way through. Binding in the constructor is super-common. I have a hard time believing redux-freeze can't handle this. I'm not sure why it's touching a component instance anyways. That was never made clear to me. |
)" This reverts commit 2118893.
)" This reverts commit 2118893.
Ok. Here you go: #735 |
…eduxjs#733)" This reverts commit 2118893.
…eduxjs#733)" This reverts commit 2118893.
Closes #708
Middleware that uses
Object.freeze
such as redux-freeze started throwing an error somewhere between versions 5.0.0...5.0.5:This is because
Connect
instances are being mutated here: https://github.com/reactjs/react-redux/blob/2726c59fa1e5929659067df2088c7c6e0d736f3a/src/components/connectAdvanced.js#L124This PR moves the context binding of the ref function to a lazy assignment and doesn't mutate the original function. IMO the intention of the code is clearer this way as well.