From fd07aeb920ddcfb45638ee9df0523022ca64d2e3 Mon Sep 17 00:00:00 2001 From: Brage <5640782+2xic@users.noreply.github.com> Date: Fri, 19 Jan 2024 20:36:07 +0100 Subject: [PATCH] Fix issue with backslash crashing the app (#291) --- components/Reference/columns.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/Reference/columns.tsx b/components/Reference/columns.tsx index 00d27851..dfa56f10 100644 --- a/components/Reference/columns.tsx +++ b/components/Reference/columns.tsx @@ -2,9 +2,15 @@ import { Row } from 'react-table' import { StackBox } from 'components/ui' -const filter = (rows: Row[], id: string, filterValue: string) => { - const re = new RegExp(`${filterValue}`, 'i') - return rows.filter((row: any) => row.original[id].match(re)) +// Possible fields are defined in `Opcodes.json` +type OpcodeRow = Row> + +const filter = (rows: OpcodeRow[], id: string, filterValue: string) => { + return rows.filter((row) => + row.original[id] + ?.toLocaleLowerCase() + .includes(filterValue.toLocaleLowerCase()), + ) } const columns = (isPrecompiled: boolean) => [