Summary
DataView offers select / multiselect filters in the "add filter" menu even when the field's filterOptions is empty. Picking one seeds a chip that has no value and nothing to choose from — a dead control the user can't complete or use.
This is common when filter options are loaded async (e.g. a "Status" or "Owner" facet whose options arrive from the server after first paint): for a moment the field is filterable: true but has zero options, and the menu still lists it.
Where it happens
components/data-view-beta/components/filters.tsx
filterableFields only checks filterable (line ~105):
const filterableFields = fields?.filter(f => f.filterable) ?? [];
availableFilters only removes already-applied fields (line ~40):
const availableFilters = fieldList?.filter(
f => !appliedFiltersSet.has(f.accessorKey)
);
Neither step checks whether a select / multiselect field actually has options.
components/data-view-beta/hooks/useFilters.tsx — onAddFilter then seeds the value from the (empty) options (line ~22):
const options = field.filterOptions || [];
...
: filterType === FilterType.select
? options[0]?.value // undefined when filterOptions is empty
So the resulting filter is { _type: 'select', value: undefined, ... } — an unpickable chip.
Request
Exclude select / multiselect fields with no filterOptions from the available-filters list, so an unusable filter is never offered. Roughly:
const isSelect =
field.filterType === 'select' || field.filterType === 'multiselect';
const hasOptions = Boolean(field.filterOptions?.length);
// keep the field only if it's not a select, or it's a select WITH options
return !isSelect || hasOptions;
Non-select filter types (string, number, date) are unaffected — they don't depend on filterOptions.
Workaround
We currently re-implement the add-filter menu (also needed for the align gap in #848) and apply this same guard client-side before offering a field. Folding the options check into Apsara's own available-filters logic would let consumers drop the guard.
Willing to contribute
Happy to open a PR if the approach looks right.
Summary
DataViewoffersselect/multiselectfilters in the "add filter" menu even when the field'sfilterOptionsis empty. Picking one seeds a chip that has no value and nothing to choose from — a dead control the user can't complete or use.This is common when filter options are loaded async (e.g. a "Status" or "Owner" facet whose options arrive from the server after first paint): for a moment the field is
filterable: truebut has zero options, and the menu still lists it.Where it happens
components/data-view-beta/components/filters.tsxfilterableFieldsonly checksfilterable(line ~105):availableFiltersonly removes already-applied fields (line ~40):Neither step checks whether a
select/multiselectfield actually has options.components/data-view-beta/hooks/useFilters.tsx—onAddFilterthen seeds the value from the (empty) options (line ~22):So the resulting filter is
{ _type: 'select', value: undefined, ... }— an unpickable chip.Request
Exclude
select/multiselectfields with nofilterOptionsfrom the available-filters list, so an unusable filter is never offered. Roughly:Non-select filter types (string, number, date) are unaffected — they don't depend on
filterOptions.Workaround
We currently re-implement the add-filter menu (also needed for the
aligngap in #848) and apply this same guard client-side before offering a field. Folding the options check into Apsara's own available-filters logic would let consumers drop the guard.Willing to contribute
Happy to open a PR if the approach looks right.