question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

after initialize SyncErrors not firing when enableReinitialize is true

See original GitHub issue

Are you submitting a bug report or a feature request?

bug report

What is the current behavior?

after I call the initialize function form not validate anymore when enableReinitialize is true. stuck on previous validation even if required fields filled.

What’s your environment?

redux form version: 6.6.3 latest

Other information

when I start debugging, find out that the values in form state in my application works without problems, but in componentWillReceiveProps in redux form nextProps.values always returning the initialized values even when I changed the form values. also, change action called in redux from and value in the view will update and render but the nextProps.values still is the initialized values.

key: 'componentWillReceiveProps',
          value: function componentWillReceiveProps(nextProps) {
            console.log('nextProps', nextProps);
            this.initIfNeeded(nextProps);
            this.validateIfNeeded(nextProps);
            this.warnIfNeeded(nextProps);
            this.clearSubmitPromiseIfNeeded(nextProps);
            this.submitIfNeeded(nextProps);
            if (nextProps.onChange) {
              if (!deepEqual(nextProps.values, this.props.values)) {
                console.log('nextProps deepequal', nextProps);
                nextProps.onChange(nextProps.values, nextProps.dispatch, nextProps);
              }
            }
          }

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
erikrascommented, Mar 30, 2018

For all of you using redux-saga, perhaps check out this tool I just built to convert actions into a Promise for libraries like redux-form.

1reaction
arthurdennercommented, Mar 14, 2018

@danielrob, here is a sandbox where you can see what it’s described in this issue: https://codesandbox.io/s/vyvw87vv2l.

For me, adding keepDirtyOnReinitialize: true solved the problem, but I’m not sure if that’s ideal or the intended behaviour.

PS: You may see a Could not find module in path: 'redux-saga/effects' error. Just refresh the preview that it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux form - enableReinitialize override previous data and ...
In order to solve this issue, I've tried to use "keepDirtyOnReinitialize" but nothing seems to change and I don't really know how to...
Read more >
Initializing From State - Redux Form
There are two methods to reinitialize the form component with new "pristine" values: Pass a enableReinitialize prop or reduxForm() config parameter set to...
Read more >
Redux-Form's SyncErrors bug - CodeSandbox
When enableReinitialize is set to true, the syncErrors doesn't update properly after `initialize`. 1.
Read more >
redux-form reset not working
It seems not correct because INITIALIZE would reset syncErrors. For many use cases, you will want to either hide your form component after...
Read more >
erikras/redux-form - Gitter
I tried adding initialValues: {} in my @connect call but it's not working. Josh Bedo ... @reduxForm({form: 'reviewForm', enableReinitialize: true, validate, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found