diff --git a/src/components/form-component.js b/src/components/form-component.js index 49dc6881e..42ebd57e7 100644 --- a/src/components/form-component.js +++ b/src/components/form-component.js @@ -98,6 +98,7 @@ function createFormClass(s = defaultStrategy) { if (this.props.getDispatch) { this.props.getDispatch(this.props.dispatch); } + clearGetFormCacheForModel(this.props.model); } UNSAFE_componentWillReceiveProps(nextProps) { @@ -409,7 +410,6 @@ function createFormClass(s = defaultStrategy) { function mapStateToProps(state, { model }) { const modelString = getModel(model, state); - clearGetFormCacheForModel(modelString); const form = s.getForm(state, modelString); invariant(form, diff --git a/test/form-component-spec.js b/test/form-component-spec.js index 712d8c952..b7064dfc2 100644 --- a/test/form-component-spec.js +++ b/test/form-component-spec.js @@ -11,6 +11,7 @@ import sinon from 'sinon'; import isValid from '../src/form/is-valid'; import { defaultTestContexts, testCreateStore, testRender } from './utils'; +import { clearGetFormCache } from '../src/utils/get-form'; import { Form as _Form, @@ -69,6 +70,10 @@ Object.keys(testContexts).forEach((testKey) => { const combineForms = testContext.combineForms; describe(`