You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
Here's my form component:
constmapStateToProps=state=>({
...state.profile.twoFactorAuth,formValues: getFormValues('twoFactorAuthentication')(state),currentUser: state.currentUser.user,})constmapDispatchToProps={changeFormValue: change,
toggleShouldVerifyPhoneNumber,}classTwoFactorAuthenticationFormextendsReact.Component{componentWillReceiveProps(nextProps){const{
isEnabledTwoFactorAuth,
changeFormValue,
formValues,
toggleShouldVerifyPhoneNumber,
shouldVerifyNumber,}=this.props// cleat two factor type and toggle off 2FAif(!nextProps.isEnabledTwoFactorAuth&&isEnabledTwoFactorAuth){changeFormValue('twoFactorAuthentication','type',null)}// reset phone number verificationif(shouldVerifyNumber&&formValues.type==='phone'&&nextProps.formValues.type!==formValues.type){toggleShouldVerifyPhoneNumber()}}componentWillUnmount(){const{
formValues,
currentUser,
changeFormValue,}=this.propsif(!currentUser.two_factor_type&&formValues.type){changeFormValue('twoFactorAuthentication','type',null)}}getSubmitBtnLabel(){const{
shouldVerifyNumber,}=this.props;returnshouldVerifyNumber ? 'Verify' : 'Save'}renderTwoFactorFields(){const{
formValues,
shouldVerifyNumber,}=this.propsif(!formValues||formValues.type==='email')returnnullif(formValues.type==='phone'){return(<div><div><Fieldname="phone"label="Phone"// mask="+1 (999) 999-9999"mask="+99 (999) 999-9999"component={FormInput}fixedLabelvalidate={required}/></div><p>
PLEASE NOTE: We will send verification codes by SMS text messages to the number you provide above.
You should verify phone number before activation. If you do not verify your number it will be blocked.
To unblock number please contact support.
</p>{shouldVerifyNumber&&<Fieldname="code"label="Verification code"component={FormInput}fixedLabelvalidate={required}/>}</div>)}}renderTwoFactorTypeSelect(){return(<Fieldname="type"component={FormRadioGroup}><RadioButtonvalue="phone"label="Send security codes to me via Text/SMS"/><RadioButtonvalue="email"label="Send security codes to me via Email at the address above"/></Field>)}render(){const{
error,
handleSubmit,
valid,
dirty,
isEnabledTwoFactorAuth,}=this.propsreturn(<formonSubmit={handleSubmit}>{isEnabledTwoFactorAuth&&this.renderTwoFactorTypeSelect()}{isEnabledTwoFactorAuth&&this.renderTwoFactorFields()}{error&&<divclassName="form-error">{error}</div>}<RaisedButtontype="submit"primarydisabled={!valid||!dirty}label={this.getSubmitBtnLabel()}/></form>)}}TwoFactorAuthenticationForm=reduxForm({form: 'twoFactorAuthentication',destroyOnUnmount: false,enableReinitialize: true,})(TwoFactorAuthenticationForm);module.exports=connect(mapStateToProps,mapDispatchToProps)(TwoFactorAuthenticationForm)
CURRENT_USER_FETCH.SUCCESS action type is dispatched before any component is mounted to DOM (except root App component)
The problem is when Redux Devtools is disabled in browser the form field value doesn't get prepopulated (tested in Chrome and Firefox)
But when I enable DevTools I'm able to get value prepopulated:
What is the expected behavior?
Field values are prepopulated
What's your environment?
Redux form version: 7.2.3
The text was updated successfully, but these errors were encountered:
ekscentrysytet
changed the title
Form initialValues are not displayed on the UI after initialize when Redux DevTools is disabled
Form initialValues are not prepopulated on the UI after initialize when Redux DevTools is disabled
Mar 1, 2018
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
Here's my form component:
initialValues
are stored in reducer:CURRENT_USER_FETCH.SUCCESS
action type is dispatched before any component is mounted to DOM (except rootApp
component)The problem is when Redux Devtools is disabled in browser the form field value doesn't get prepopulated (tested in Chrome and Firefox)
![form_issue](https://user-images.githubusercontent.com/10062298/36850503-adbf27e0-1d6f-11e8-861a-6b665f3792ff.png)
But when I enable DevTools I'm able to get value prepopulated:
![image](https://user-images.githubusercontent.com/10062298/36850720-30a1b8ee-1d70-11e8-9191-3f0a97a969d7.png)
What is the expected behavior?
Field values are prepopulated
What's your environment?
Redux form version:
7.2.3
The text was updated successfully, but these errors were encountered: