diff --git a/.changeset/wise-snakes-boil.md b/.changeset/wise-snakes-boil.md new file mode 100644 index 00000000..88b42a31 --- /dev/null +++ b/.changeset/wise-snakes-boil.md @@ -0,0 +1,5 @@ +--- +"@premieroctet/next-admin": patch +--- + +Fix relation one-to-many - nullable relation diff --git a/packages/next-admin/src/components/inputs/SelectWidget.tsx b/packages/next-admin/src/components/inputs/SelectWidget.tsx index 5c57b740..e86747a7 100644 --- a/packages/next-admin/src/components/inputs/SelectWidget.tsx +++ b/packages/next-admin/src/components/inputs/SelectWidget.tsx @@ -36,7 +36,7 @@ const SelectWidget = ({ const { basePath } = useConfig(); - const handleChange = (option: Enumeration) => { + const handleChange = (option: Enumeration | null) => { setFieldDirty(props.name); onChange(option); onClose(); @@ -95,7 +95,7 @@ const SelectWidget = ({ className="flex items-center" onClick={(e) => { e.preventDefault(); - onChange({}); + handleChange(null); }} >