Skip to content

Commit

Permalink
fix: respect falsey booleans types in select/radio fields
Browse files Browse the repository at this point in the history
  • Loading branch information
thopedam authored Dec 18, 2024
1 parent d573b3a commit 3406b01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const RadioField = ({
name={name}
onChange={(e) => {
const jsonValue =
safeJsonParse(e.target.value) || e.target.value;
safeJsonParse(e.target.value) ?? e.target.value;

if (flatOptions.indexOf(jsonValue) > -1) {
onChange(jsonValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const SelectField = ({
className={getClassName("input")}
disabled={readOnly}
onChange={(e) => {
const jsonValue = safeJsonParse(e.target.value) || e.target.value;
const jsonValue = safeJsonParse(e.target.value) ?? e.target.value;

if (flatOptions.indexOf(jsonValue) > -1) {
onChange(jsonValue);
Expand Down

0 comments on commit 3406b01

Please sign in to comment.