mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
allow user to return nothing in submitCallback
Useful when the callback is meant for side effect and not for modifying the data
This commit is contained in:
parent
5427e994b0
commit
755d5f6ad0
1 changed files with 4 additions and 4 deletions
|
@ -227,7 +227,7 @@ class SmartForm extends Component {
|
||||||
- Nested array item: 'addresses.1.city'
|
- 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
|
// default to overwriting old value with new
|
||||||
const { mode = 'overwrite' } = options;
|
const { mode = 'overwrite' } = options;
|
||||||
|
|
||||||
// keep the previous ones and extend (with possible replacement) with new ones
|
// keep the previous ones and extend (with possible replacement) with new ones
|
||||||
this.setState(prevState => {
|
this.setState(prevState => {
|
||||||
|
|
||||||
// keep only the relevant properties
|
// keep only the relevant properties
|
||||||
const { currentValues, currentDocument, deletedValues } = cloneDeep(prevState);
|
const { currentValues, currentDocument, deletedValues } = cloneDeep(prevState);
|
||||||
const newState = { currentValues, currentDocument, deletedValues, foo: {} };
|
const newState = { currentValues, currentDocument, deletedValues, foo: {} };
|
||||||
|
@ -811,7 +811,7 @@ class SmartForm extends Component {
|
||||||
|
|
||||||
// if there's a submit callback, run it
|
// if there's a submit callback, run it
|
||||||
if (this.props.submitCallback) {
|
if (this.props.submitCallback) {
|
||||||
data = this.props.submitCallback(data);
|
data = this.props.submitCallback(data) || data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getFormType() === 'new') {
|
if (this.getFormType() === 'new') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue