Skip to content

Commit

Permalink
Nullable realtionship (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
cregourd authored Oct 7, 2024
1 parent 3225788 commit 81b2e54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-snakes-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin": patch
---

Fix relation one-to-many - nullable relation
4 changes: 2 additions & 2 deletions packages/next-admin/src/components/inputs/SelectWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SelectWidget = ({

const { basePath } = useConfig();

const handleChange = (option: Enumeration) => {
const handleChange = (option: Enumeration | null) => {
setFieldDirty(props.name);
onChange(option);
onClose();
Expand Down Expand Up @@ -95,7 +95,7 @@ const SelectWidget = ({
className="flex items-center"
onClick={(e) => {
e.preventDefault();
onChange({});
handleChange(null);
}}
>
<XMarkIcon className="h-5 w-5 cursor-pointer text-gray-400" />
Expand Down

0 comments on commit 81b2e54

Please sign in to comment.