From 38f11870ec34ae23d61da19831705077521a9d93 Mon Sep 17 00:00:00 2001 From: aashimgarg Date: Fri, 16 Feb 2024 14:17:40 +0530 Subject: [PATCH] refactor resource filtering to trim filter values --- src/pages/resource.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/resource.js b/src/pages/resource.js index 6ff434cb..d1ecdf4c 100644 --- a/src/pages/resource.js +++ b/src/pages/resource.js @@ -153,7 +153,7 @@ const Resources = ({ data }) => { { value: 'Reports', label: 'Reports' }, { value: 'Blog', label: 'Blog' }, { value: 'Published Papers', label: 'Published Papers' }, - { value: 'Guidebook ', label: 'Guidebook ' } + { value: 'Guidebook', label: 'Guidebook' } ]; const sectors = [ @@ -178,8 +178,8 @@ const Resources = ({ data }) => { }; const filteredResources = allResources.filter((resource) => { - const filterByType = !TypeFilter || TypeFilter.value === 'All' || resource.type === TypeFilter.value; - const filterBySector = !sectorFilter || sectorFilter.value === 'All' || resource.sector === sectorFilter.value; + const filterByType = !TypeFilter || TypeFilter.value === 'All' || resource.type === TypeFilter.value.trim(); + const filterBySector = !sectorFilter || sectorFilter.value === 'All' || resource.sector === sectorFilter.value.trim(); return filterByType && filterBySector; });