DataView: don't offer select/multiselect filters with empty filterOptions
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Empieza en components/data-view-beta/components/filters.tsx leyendo filterableFields y availableFilters; después, inspecciona onAddFilter en components/data-view-beta/hooks/useFilters.tsx. Confirma que los campos select y multiselect con filterOptions vacíos se excluyen, mientras que los filtros que no son select siguen disponibles, y que los filtros select con opciones disponibles todavía se pueden añadir.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
filterableFieldsonly checksfilterable(line ~105):const filterableFields = fields?.filter(f => f.filterable) ?? [];availableFiltersonly 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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 69
- Forks
- 13
- Merge medio
- 3 d 15 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de raystack/apsara
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 2 días
Todos los issues de raystack/apsara
Issues similares
-
cleanName keeps a state code that's joined to the word before it (SavannahGa → "Savannah Ga")Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openwatersio/slackwater-database#281 ·
Los mantenedores suelen responder en 1 día
-
accepted bug via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
pingdotgg/t3code#18690 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bayern feature:Application ready web
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
digitalfabrik/entitlementcard#3176 ·
Los mantenedores suelen responder en 7 días
-
[BUG] 运行位置的分支列表不自动刷新,外部新建的分支看不到Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NanmiCoder/cc-haha#1533 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día