From 4f5dede0ae01bde98730cc08b1f7507cf251bf3d Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 12 Aug 2026 09:56:41 +0530 Subject: [PATCH] fix: preserve falsy select filter values in FilterChip FilterChip seeded its internal value state with `value || ''`, so a falsy option value was discarded on mount. A DataView select filter whose first option is `0` applied `0` to the query but rendered the "Select value" placeholder, leaving the chip visibly unset while a filter was active. The same coercion blanked the Input for `defaultFilterValue: 0` on number and string columns. Use `??` so only null/undefined fall back to the empty string. Co-Authored-By: Claude Opus 5 (1M context) --- packages/raystack/components/filter-chip/filter-chip.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/raystack/components/filter-chip/filter-chip.tsx b/packages/raystack/components/filter-chip/filter-chip.tsx index 5c5aed77e..b5359fb06 100644 --- a/packages/raystack/components/filter-chip/filter-chip.tsx +++ b/packages/raystack/components/filter-chip/filter-chip.tsx @@ -113,7 +113,8 @@ export const FilterChip = ({ const [operation, setOperation] = useState( computedOperations?.[0] ); - const [filterValue, setFilterValue] = useState(value || ''); + // `??` not `||` — a falsy option value like `0` is a real selection. + const [filterValue, setFilterValue] = useState(value ?? ''); const showOnRemove = typeof onRemove === 'function'; const isMultiSelectColumn = columnType === FilterType.multiselect;