Skip to content

Commit

Permalink
fix: crash when options.model.edit is not defined (#410)
Browse files Browse the repository at this point in the history
* fix: crash when options.model.edit is not defined

* chore: add changeset
  • Loading branch information
yaKashif authored Sep 10, 2024
1 parent 4f3e9d6 commit 8c9405f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clever-coins-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin": patch
---

fix crash when edit object is not defined in options.model
2 changes: 1 addition & 1 deletion packages/next-admin/src/utils/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ export const removeHiddenProperties =
export const addCustomProperties =
<M extends ModelName>(resource: M, editOptions: EditOptions<M>) =>
(schema: Schema) => {
const customFieldKeys = Object.keys(editOptions.customFields ?? {});
const customFieldKeys = Object.keys(editOptions?.customFields ?? {});

customFieldKeys.forEach((property) => {
const fieldOptions = editOptions?.customFields?.[property];
Expand Down

0 comments on commit 8c9405f

Please sign in to comment.