redux-form: When are UNREGISTER_FIELD and REGISTER_FIELD events dispatched?
Are you submitting a bug report or a feature request?
Just asking info. Might be a bug.
Why am I asking this?
One of my fields keeps getting unregistered and registered after change or blur event on any field. Which destroys the error state and thus forcing me to use destroyOnUnmount: false on my form component.
What’s your environment?
From my package.json
"dependencies": {
"axios": "^0.16.2",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.5",
"react-router-dom": "^4.1.1",
"redux": "^3.7.2",
"redux-form": "^7.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"semantic-ui-css": "^2.2.11",
"semantic-ui-react": "^0.71.0"
}
Also the HOCs used on my form component:
CreateJobForm = reduxForm({
form: 'createJob',
destroyOnUnmount: false
})(CreateJobForm);
const selector = formValueSelector('createJob');
CreateJobForm = connect(state => {
return selector(state, 'device', 'brand', 'model' );
})(CreateJobForm)
export default CreateJobForm;
My Feild looks like this:
<Field name="location" type="text" label='Location(Pincode)'
component={MyFeild}
Comp={Form.Input}
validate={[required, number, length(6)]}
/>
Other information
I know this might not be enough to identify the issue but i wanted to understand the problem better first.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Add note on validate/warn prop re-registering Documentation for #3094, #3211. — committed to redux-form/redux-form by danielrob 7 years ago
- Add note on validate/warn prop re-registering Documentation for #3094, #3211. — committed to redux-form/redux-form by danielrob 7 years ago
- Add note on validate/warn prop re-registering Documentation for #3094, #3211. — committed to redux-form/redux-form by danielrob 7 years ago
- Add note on validate/warn prop re-registering (#3271) Documentation for #3094, #3211. — committed to redux-form/redux-form by danielrob 7 years ago
I have a wizard type form and up to 6.7.0 it was working fine with fields on the pages getting registered when the page is rendered (i.e. redux-form/REGISTER_FIELD fired). After changing a value in a field redux-form/CHANGE and redux-form/BLUR were dispatched. When you go to the next page you get redux-form/UNREGISTER_FIELD and everything was nice and shiny.
Now, I have to click twice for a field to get focus (as some intermediate re-rendering of the whole page happens) and when I change a field value, I only get redux-form/CHANGE and every field on the respective wizard page gets UNREGISTERED and then REGISTERED again- and yes the whole page renders again (seems weird, esp. with animations 😃 ), not only the field changed. So I am destined to some hair pulling tonight…