Merge pull request #2051 from lbke/feature/submitCallback

Allow user to return nothing in submitCallback
This commit is contained in:
Sacha Greif 2018-09-06 11:17:28 +09:00 committed by GitHub
commit 2dfc7d14ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,7 +227,7 @@ class SmartForm extends Component {
- Nested array item: 'addresses.1.city'
*/
compactParent(data, path);
compactParent(data, path);
}
});
@ -572,10 +572,10 @@ class SmartForm extends Component {
// default to overwriting old value with new
const { mode = 'overwrite' } = options;
// keep the previous ones and extend (with possible replacement) with new ones
this.setState(prevState => {
// keep only the relevant properties
const { currentValues, currentDocument, deletedValues } = cloneDeep(prevState);
const newState = { currentValues, currentDocument, deletedValues, foo: {} };
@ -811,7 +811,7 @@ class SmartForm extends Component {
// if there's a submit callback, run it
if (this.props.submitCallback) {
data = this.props.submitCallback(data);
data = this.props.submitCallback(data) || data;
}
if (this.getFormType() === 'new') {