Skip to content

Commit

Permalink
never include undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
Rani committed Jul 5, 2022
1 parent ab035ca commit a6753b5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/core/src/utils.js
Expand Up @@ -233,18 +233,14 @@ function computeDefaults(
(formData || {})[key],
includeUndefinedValues
);
if (includeUndefinedValues) {
acc[key] = computedDefault;
} else {
if (typeof computedDefault === "object") {
// Store computedDefault if it's a non-empty object (e.g. not {})
if (!isEmpty(computedDefault)) {
acc[key] = computedDefault;
}
} else if (computedDefault !== undefined) {
// Store computedDefault if's a defined primitive (e.g. true)
if (typeof computedDefault === "object") {
// Store computedDefault if it's a non-empty object (e.g. not {})
if (!isEmpty(computedDefault)) {
acc[key] = computedDefault;
}
} else if (computedDefault !== undefined) {
// Store computedDefault if's a defined primitive (e.g. true)
acc[key] = computedDefault;
}
return acc;
}, {});
Expand Down

0 comments on commit a6753b5

Please sign in to comment.