🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(filters): decode empty arrayOptions value as empty array in URL roundtrip (#12229)
Hunmin Kimb8b9e1012162
diff --git a/web/src/features/filters/filter-integration.clienttest.ts b/web/src/features/filters/filter-integration.clienttest.tsindex 03ce82ad1d..132e4ff218 100644--- a/web/src/features/filters/filter-integration.clienttest.ts+++ b/web/src/features/filters/filter-integration.clienttest.ts@@ -250,6 +250,24 @@ describe("Filter Query Encoding Integration (Full URL Lifecycle)", () => {// Empty filtersexpect(simulateUrlFlow([])).toEqual([]);});++ it("should round-trip arrayOptions with empty value as [] not ['']", () => {+ // When user clicks ALL toggle with no checkboxes, value is []+ const filters: FilterState = [+ {+ column: "tags",+ type: "arrayOptions",+ operator: "all of",+ value: [],+ },+ ];++ const result = simulateUrlFlow(filters);++ // Must decode back to [] — not [""] which causes hasAll(tags, ['']) → 0 results+ expect(result).toEqual(filters);+ expect(result[0]?.value).toEqual([]);+ });});describe("Saved View Validation (Backward & Forward Compatibility)", () => {diff --git a/web/src/features/filters/lib/filter-query-encoding.ts b/web/src/features/filters/lib/filter-query-encoding.tsindex 82f34bfe79..8ee16accca 100644--- a/web/src/features/filters/lib/filter-query-encoding.ts+++ b/web/src/features/filters/lib/filter-query-encoding.ts@@ -151,9 +151,11 @@ export function decodeFiltersGeneric(query: string): FilterState {// Split on unescaped pipe characters only, then unescape each valueparsedValue = decodedValue? splitOnUnescapedPipe(decodedValue).map(unescapePipeInValue)- : decodedValue === ""- ? [""] // allow empty strings (i.e, filter for empty trace name)- : [decodedValue];+ : type === "arrayOptions"+ ? [] // Empty array for arrayOptions — empty strings are not valid array values (e.g., tags)+ : decodedValue === ""+ ? [""] // allow empty strings for stringOptions (i.e, filter for empty trace name)+ : [decodedValue];} else if (type === "boolean") {parsedValue = decodedValue === "true";} else {