Skip to content

Commit

Permalink
fix: safely evaluates field.admin in WhereBuilder (#6534)
Browse files Browse the repository at this point in the history
## Description

Safely evaluates `field.admin` in WhereBuilder

- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [x] Existing test suite passes locally with my changes
  • Loading branch information
PatrikKozak authored May 28, 2024
1 parent f07783a commit 4f9d78d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const reduceFields = (fields, i18n) =>
},
}

if ('disableListFilter' in field.admin && field.admin?.disableListFilter) return reduced
if (field.admin && 'disableListFilter' in field.admin && field.admin?.disableListFilter)
return reduced

return [...reduced, formattedField]
}
Expand Down

0 comments on commit 4f9d78d

Please sign in to comment.