From 2ed9ba4d61503c76e1c39f6981ef75710a98f54a Mon Sep 17 00:00:00 2001 From: lindtvedtsebastian <46536611+lindtvedtsebastian@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:47:17 +0200 Subject: [PATCH] chore(search): fix regex search boards bug (#1543) --- next-tavla/app/(admin)/boards/components/TableRows/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/next-tavla/app/(admin)/boards/components/TableRows/index.tsx b/next-tavla/app/(admin)/boards/components/TableRows/index.tsx index c7357b464..45c238ab8 100644 --- a/next-tavla/app/(admin)/boards/components/TableRows/index.tsx +++ b/next-tavla/app/(admin)/boards/components/TableRows/index.tsx @@ -14,7 +14,10 @@ function TableRows({ boards }: { boards: TBoard[] }) { const columns = useSearchParam('columns')?.split(',') ?? DEFAULT_BOARD_COLUMNS const sortFunction = useSortBoardFunction() - const searchFilter = new RegExp(search, 'i') + const searchFilter = new RegExp( + search.replace(/[^a-z/Wæøå0-9- ]+/g, ''), + 'i', + ) const filterByTitle = (board: TBoard) => searchFilter.test(board?.meta?.title ?? DEFAULT_BOARD_NAME)