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
[BUG] FormStateToRedux - Maximum update depth exceeded #335
Comments
I'm sorry, but I'm not seeing that error when typing in the fields. Can you give me some steps to reproduce? |
Yeah, that's one of the ones above. I clicked on them all. What do I have to do to recreate the error? |
The code is updated |
fuck, something wrong in my example |
updated again const ConnectedReduxContainer = connect((state) => ({
state: getFormState(state, "example")
}))(Container); |
Ooh!!! This was an interesting one!! The I think that it probably needs to do a deep equals check on Personally, I would not connect the container of the form to Redux in this way; I would only connect whatever particular deeper component needs that state. Makes sense? |
Oh, my initialValues depended from BackEnd, it`s cant be static |
That's fine, as long as it's the same object coming from Redux or whatever is loading them. You just can't construct a new object when passing the prop. That said, I will implement deep equals on the |
as example i can define initial values in component constructor, makes sense? |
Yep. As long as the object is only instantiated when they actually change, you should be fine. |
when you planned fix it? |
Yes, sorry. This week has been busy. |
Okay, so |
@erikras would you consider using react-fast-compare to compare |
Published fix in |
@arthurdenner My reasoning on going with a function prop is that most people won't need it, as most forms are not deeply structured, but to allow flexibility for those that are. |
@erikras Got it. Thanks for explaining it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
All forms with initial values
No nested input names
Original simple example - codesandbox
Original example with connected Container - codesandbox
Nested input names
Bug
Original example with connected Container and nested initialValues & input names - codesandbox
Fix
Original example with connected Container & Form and nested initialValues & input names - codesandbox
The text was updated successfully, but these errors were encountered: