From 8e555cce9e5621b5ae44f00b58ee1fb8e1a8bb4c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:41:31 -0700 Subject: [PATCH] Fix: only filter by string or number properties for filter pipe (#7699) --- src-ui/src/app/pipes/filter.pipe.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src-ui/src/app/pipes/filter.pipe.ts b/src-ui/src/app/pipes/filter.pipe.ts index d48c2ad5d..64765bd6a 100644 --- a/src-ui/src/app/pipes/filter.pipe.ts +++ b/src-ui/src/app/pipes/filter.pipe.ts @@ -10,11 +10,16 @@ export class FilterPipe implements PipeTransform { if (!searchText) return items return items.filter((item) => { - return Object.keys(item).some((key) => { - return String(item[key]) - .toLowerCase() - .includes(searchText.toLowerCase()) - }) + return Object.keys(item) + .filter( + (key) => + typeof item[key] === 'string' || typeof item[key] === 'number' + ) + .some((key) => { + return String(item[key]) + .toLowerCase() + .includes(searchText.toLowerCase()) + }) }) } }