From 2140d9ed16b9247131c88701a640bade71566b8c Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 8 Mar 2024 19:08:49 +0100 Subject: [PATCH] fix(filter): don't transform anything when input is empty --- frontend/src/helpers/filters.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/helpers/filters.ts b/frontend/src/helpers/filters.ts index 5f8a5c389..a8b36af4e 100644 --- a/frontend/src/helpers/filters.ts +++ b/frontend/src/helpers/filters.ts @@ -66,6 +66,11 @@ export function transformFilterStringForApi( labelResolver: (title: string) => number | null, projectResolver: (title: string) => number | null, ): string { + + if (filter.trim() === '') { + return '' + } + // Transform labels to ids LABEL_FIELDS.forEach(field => { const pattern = getFieldPattern(field) @@ -110,6 +115,11 @@ export function transformFilterStringFromApi( labelResolver: (id: number) => string | null, projectResolver: (id: number) => string | null, ): string { + + if (filter.trim() === '') { + return '' + } + // Transform all attributes from snake case AVAILABLE_FILTER_FIELDS.forEach(f => { filter = filter.replace(snakeCase(f), f)