mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
Cast values to numbers when calling updateCurrentValues
This commit is contained in:
parent
ce4299a6fe
commit
0d69d81301
1 changed files with 9 additions and 1 deletions
|
@ -693,13 +693,21 @@ class SmartForm extends Component {
|
|||
|
||||
Object.keys(newValues).forEach(key => {
|
||||
const path = key;
|
||||
const value = newValues[key];
|
||||
let value = newValues[key];
|
||||
|
||||
if (isEmptyValue(value)) {
|
||||
// delete value
|
||||
unset(newState.currentValues, path);
|
||||
set(newState.currentDocument, path, null);
|
||||
newState.deletedValues = [...prevState.deletedValues, path];
|
||||
} else {
|
||||
|
||||
// cast to correct type if needed
|
||||
// TODO: cast based on actual schema field type
|
||||
if (!isNaN(value)) {
|
||||
value = parseFloat(value);
|
||||
}
|
||||
|
||||
// 1. update currentValues
|
||||
set(newState.currentValues, path, value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue