fix(ui): skip disabled fields when adding OR filter conditions in list view (#13004)

### What?

Fixes a bug where adding an additional OR filter condition in the list
view selects a field with `admin.disableListFilter: true`, causing all
filter fields to appear disabled.

### Why?

When the first field in a collection has `disableListFilter` set to
`true`, adding a second OR condition defaults to using that field. This
leads to a broken filter UI where no valid fields are selectable.

### How?

Replaces the hardcoded usage of `reducedFields[0]` with a call to
`reducedFields.find(...) `that skips fields with `disableListFilter:
true`, consistent with the logic already used when adding the first
filter condition.

Fixes #12993
This commit is contained in:
Patrik
2025-07-01 14:35:48 -04:00
committed by GitHub
parent b1ae749311
commit 7a40a9fc06

View File

@@ -185,7 +185,7 @@ export const WhereBuilder: React.FC<WhereBuilderProps> = (props) => {
onClick={async () => {
await addCondition({
andIndex: 0,
field: reducedFields[0],
field: reducedFields.find((field) => !field.field.admin?.disableListFilter),
orIndex: conditions.length,
relation: 'or',
})