Skip to content

resolveListViewSearchField

resolveListViewSearchField<TFieldSlug>(props): TFieldSlug | undefined

Defined in: packages/core/src/collections/listView/listViewSearchFields.ts:54

Resolves the ACTUAL search field a query should use — the single resolution point CollectionListView (feeding useVexListQuery), ListViewSearch (the field picker’s displayed/default value), and NextAdminPage (the server prefetch, Design Decision 44) all call, so they can never disagree about which field q searches by default.

Decision 9: “qf … omitted when it is the default field” — a URL with no qf (or an invalid/unreadable one) must still resolve to a real, readable field before reaching the server, never undefined while a search is active (an undefined searchField with a non-empty search is a hard error in useVexListQuery, Decision 3’s config-time guarantee that every searchField entry has a declared index only covers the field NAMES, not a caller forgetting to default one).

TFieldSlug extends string = string

Input props.

CollectionConfig

The collection whose admin.view.state.searchFields to resolve against.

ResolvedFieldPermissions

The caller’s resolved field-read permissions (useFieldPermissions).

TFieldSlug | undefined

The URL’s raw qf, or undefined.

TFieldSlug | undefined

qf itself when it names a readable searchField entry; otherwise the first readable entry; undefined when NO entry is readable (search is unavailable — ListViewSearch renders nothing in that case, and the caller must not send a search query either).