fix(filter): don't transform anything when input is empty

This commit is contained in:
kolaente 2024-03-08 19:08:49 +01:00
parent 533e778b93
commit be253333c2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 10 additions and 0 deletions

View File

@ -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)