davidkpiano / react-redux-form

Create forms easily in React with Redux.
https://davidkpiano.github.io/react-redux-form
MIT License
2.07k stars 251 forks source link

924 form cache clearing #1184

Closed brycesenz closed 6 years ago

brycesenz commented 6 years ago

Fixes the issue described here - https://github.com/davidkpiano/react-redux-form/issues/924

Without understanding the internals in too much depth, it looks like formStateKeyCache was introduced as a way to track which parent form relationships for the models provided on Field attributes, in a way that would allow both Fields and Forms to use that get-form utility class.

Where this seems to break down is that for form-level models that aren't present at initialization, they never get the proper form structure in redux.

This PR addresses that by resetting the cached data form the provided model string, but only within the form component, and only when the state is being mapped to that model initially.

davidkpiano commented 6 years ago

LGTM - once the linting errors are fixed (max-length for lines) I'll merge this in. Thanks!

brycesenz commented 6 years ago

@davidkpiano - linting issues fixed; we should be good to go. Thanks for the quick review, and thanks again for such an awesome library!