davidkpiano / react-redux-form

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

rrf/change fires AFTER custom change handler #1162

Open deserthurricane opened 6 years ago

deserthurricane commented 6 years ago

The Problem

rrf/change action fires AFTER custom onChange handler. So the outdated data from the store is being passed to it.

Steps to Reproduce

For example, I have a <Control.Checkbox/> component in my app.

<Checkbox
   model="application.sms_notification"
   label="SMS notification"
   onChange={this.handleCalculatorChange} / *custom handler which collects data 
from application store and sends API request with it immediately */
 />

What happens when the checkbox is checked/unchecked?

Expected Behavior

First rrf/change fires and updates the store, than the custom handler is executed.

Actual Behavior

rrf/change action fires AFTER handleCalculatorChange. So the outdated data is being passed!

Reproducible Code Example

https://codesandbox.io/s/nr8o8rxmkp

mellis481 commented 6 years ago

I just ran into this same issue.

kevinkashou commented 6 years ago

Any updates on this?

Huespal commented 5 years ago

Same here. It is a headache.