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
[v7.4.0] initialValues not working #4069
Comments
just updated from 7.3 to 7.4 and seeing the same thing. all our initial values are gone. seeing no errors. using redux 4.0.0 |
Same issue here. Using redux v 3.x.x. Had to downgrade to v.7.3to make things work again |
I updated to react 16.4 and that seemed to have fixed it. I was using 15.4 before. |
I can confirm this issue on react 15.6.2. The redux-form/INITIALIZE event does not fire |
Thanks for the confirmation, folks. |
also i have a lot of bugs with 7.4.0, in general form init and validators not working at all (react 15.6.2 and redux-form 7.4.0). now i'm looking where is problem |
I just spent a couple hours trying to diagnose this as well. Pinning to version 7.3.0 in your package.json will fix the issue. It appears that, in This is because the method name changed to I would imagine that having two methods, Maintainers, please let me know if you'd like a PR with my proposed solution! |
I'm just glad to see the Redux Forms authors have as tough a time testing their library as I do. |
Adding to @JoshMock's point, it appears that |
Hello folks, thanks for looking at this issue with a magnifying glass. |
@gustavohenke, @jpdesigndev, @JoshMock
See: open-source-project-maintainers & gradual-migration-path sections of the react blogs update-on-async-rendering |
Not fixed yet. |
Thank you guys for the follow up!. You are awesome. I'm afraid i've got some bad news. Just update to v4.7.1 but it's still not working. I've updated the redux-form version in codesandbox and the problem persist. |
Published ACTUAL fix in |
It is working now. BIG thanks! |
Thank you guys! |
@jedwards1211 could you elaborate? I seem to have the same issue with version |
Actually, I finally found an issue someone already filed for what I'm talking about: #3459 |
I believe this is still a bug, my solution is to call |
^^ Here's a sandbox: https://codesandbox.io/s/ryo81qz60q |
[redux-form version 8.1.0] |
I have tried above solution but still its not working. It's not updating initial value of props. redux state and everything is fine but rerender is not being called. |
One more option: |
I'm having the same problem with Calling |
Same here |
Bug still can be reproduced under |
I can confirm this is still an issue ( |
I have a slightly different work around.
The first useEffect() is required so that we don't need to add change as a dependency in the second (which would cause the useEffect function to execute continuosly). I'm sure there are better ways to do this.. |
@made-in-nz FWIW you don't need that first const latestChange = useRef(change);
latestChange.current = change; And really, you can probably just get away with useEffect(() => {
change('RecordType', regtype);
}, [regtype]); because the closure of that function always comes from a single render, so |
Thanks @jedwards1211 for the first suggestion, that makes sense.
The behaviour is fine though. |
Yeah, that's a linting rule designed to make sure you don't accidentally leave out necessary dependencies...it can be nice to intentionally omit something in cases like this, but having the linting rule is also handy 🤷♂ |
This issue can be easily reproduced by providing same |
Can confirm, for me this was the reason the form values did not update. Thank you @andrew-aladev for pointing this out 🙏 |
Something is completely wrong with the following lines of code. It is hard to understand this logic. I am reproducing issue with the following env:
So it looks like logic is broken here:
We don't need to update initial values, but why we are resetting it with empty object? See here the following blame. Everything except |
This small commit was related to #4020 and it is wrong. We need to fix this issue in another way. |
I've updated this code with the following:
Now both |
The following code When
This code is broken. |
The line above should be the following:
I've tested it in our current project and it works perfect. I will create a pull request later. |
…zation according to tests
…nge values with keepValues
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
initialValues prop is not working on initial mount after update to 7.4.0
Sandbox Link
I've modified the Initialize from state demo just to show the issue. I've just change:
to get values directly from the variable instead after clicking the button.
https://codesandbox.io/s/ox3p66023q
As you can see the fields are empty. If you change the redux-form version to 7.3.0 it works.
What's your environment?
redux-form 7.4.0
The text was updated successfully, but these errors were encountered: