From 18308d5055e14853245f9c1027508444b7e66e00 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 17 Dec 2023 23:59:02 +0800 Subject: [PATCH] Fix search bar crashing if remarks on item instance is null --- .../EquipmentInstancesListPage.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Pages/EquipmentInstancesListPage/EquipmentInstancesListPage.tsx b/src/Pages/EquipmentInstancesListPage/EquipmentInstancesListPage.tsx index b08d26b..78cdb4a 100644 --- a/src/Pages/EquipmentInstancesListPage/EquipmentInstancesListPage.tsx +++ b/src/Pages/EquipmentInstancesListPage/EquipmentInstancesListPage.tsx @@ -146,12 +146,14 @@ export default function EquipmentInstancesListPage() { .toLowerCase() .includes(filter.toLowerCase()) || equipment.remarks - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.last_updated - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.status.toLowerCase() == filter.toLowerCase() + ? equipment.remarks + .toLowerCase() + .includes(filter.toLowerCase()) + : false || + equipment.last_updated + .toLowerCase() + .includes(filter?.toLowerCase()) || + equipment.status.toLowerCase() == filter.toLowerCase() : // If filter keyword is null then we just pass through everything as if we did not filter at all true )