From b805ee1bc0cecbfca5723af2c8adc8d6d5ef125e Mon Sep 17 00:00:00 2001 From: elizielx Date: Mon, 12 Feb 2024 08:16:40 +0800 Subject: [PATCH] refactor(app): initially display all data instead of none from fuse.js --- apps/app/src/pages/complain/form/tempat-sampah.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/app/src/pages/complain/form/tempat-sampah.tsx b/apps/app/src/pages/complain/form/tempat-sampah.tsx index d7947f4..9cc6c72 100644 --- a/apps/app/src/pages/complain/form/tempat-sampah.tsx +++ b/apps/app/src/pages/complain/form/tempat-sampah.tsx @@ -26,7 +26,8 @@ export function ComplainFormTempatSampah() { const fuse = new Fuse(!isLoading ? (data.data as TrashBin[]) : [], fuseOptions); - const filteredData = !isLoading ? fuse.search(searchTerm).map((result) => result.item) : []; + const filteredData = + !isLoading && searchTerm === "" ? data.data : fuse.search(searchTerm).map((result) => result.item); return ( @@ -61,7 +62,7 @@ export function ComplainFormTempatSampah() {