Skip to content

Commit

Permalink
FinalFormSelect: Fix value 0 and false not being clearable (#2523)
Browse files Browse the repository at this point in the history
Fix bug that made the number 0 unclearable when used as a value inside a
SelectField.

---------

Co-authored-by: Markus Fichtner <[email protected]>
Co-authored-by: Ricky James Smith <[email protected]>
  • Loading branch information
3 people authored Sep 17, 2024
1 parent 3b0dd14 commit bc1ed88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/six-vans-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": patch
---

FinalFormSelect: Fix value `0` and `false` not being clearable
2 changes: 1 addition & 1 deletion packages/admin/admin/src/form/FinalFormSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const FinalFormSelect = <T,>({
const endAdornment = !required ? (
<ClearInputAdornment
position="end"
hasClearableContent={Boolean(multiple ? (Array.isArray(value) ? value.length : value) : value)}
hasClearableContent={Boolean(multiple ? (Array.isArray(value) ? value.length : value !== undefined) : value !== undefined)}
onClick={() => onChange(multiple ? [] : undefined)}
/>
) : null;
Expand Down

0 comments on commit bc1ed88

Please sign in to comment.