From 016e3dd5c79a6f8d9036900d1852d706363d4e6d Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Fri, 29 Nov 2024 21:13:16 +0530 Subject: [PATCH] update pr --- src/pages/block.tsx | 8 ++++---- src/pages/district.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index f5e91f85..d4cf1bb1 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -188,7 +188,7 @@ const setIsArchived = useSubmittedButtonStore( const districts = data?.result?.values || []; setDistrictsOptionRead(districts); - const districtNameArray = districts.map((item: any) => item.label.toLowerCase()); + const districtNameArray = districts.map((item: any) => item.label?.toLowerCase()); setDistrictNameArr(districtNameArray); const districtCodeArray = districts.map((item: any) => item.value); @@ -262,7 +262,7 @@ const setIsArchived = useSubmittedButtonStore( } ) .filter((district: { label: any }) => - districtNameArr.includes(district.label.toLowerCase()) + districtNameArr.includes(district.label?.toLowerCase()) ); if (isFirstVisit) { if ( @@ -321,7 +321,7 @@ const setIsArchived = useSubmittedButtonStore( const blocks = response?.result?.values || []; setBlocksOptionRead(blocks); - const blockNameArray = blocks.map((item: any) => item.label.toLowerCase()); + const blockNameArray = blocks.map((item: any) => item.label?.toLowerCase()); setBlockNameArr(blockNameArray); const blockCodeArray = blocks.map((item: any) => item.value); @@ -412,7 +412,7 @@ const setIsArchived = useSubmittedButtonStore( }; } ) - .filter((block: { name: string }) => blockNameArr.includes(block.name.toLocaleLowerCase())); + .filter((block: { name: string }) => blockNameArr.includes(block.name?.toLocaleLowerCase())); setBlockData(filteredBlockData); setShowAllBlocks(filteredBlockData); diff --git a/src/pages/district.tsx b/src/pages/district.tsx index 77a93e93..42ea42b0 100644 --- a/src/pages/district.tsx +++ b/src/pages/district.tsx @@ -146,7 +146,7 @@ const District: React.FC = () => { const districts = data?.result?.values || []; setDistrictsOptionRead(districts); - const districtNameArray = districts.map((item: any) => item.label.toLowerCase()); + const districtNameArray = districts.map((item: any) => item.label?.toLowerCase()); setDistrictNameArr(districtNameArray); const districtCodeArray = districts.map((item: any) => item.value); @@ -252,7 +252,7 @@ const District: React.FC = () => { const matchingDistrict = districtsOptionRead.find( (district: { label: string }) => - district.label.toLowerCase() === transformedName.toLowerCase() + district.label?.toLowerCase() === transformedName?.toLowerCase() ); return {