From 2a20e8d1bf9f73d48e622ddd328fd6df5c9bb24e Mon Sep 17 00:00:00 2001 From: Jim Barnes Date: Fri, 23 Aug 2024 16:02:05 -0400 Subject: [PATCH] Fixed key index issue with search results --- src/App.tsx | 8 ++++---- src/components/SearchResults.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1f8719f..c856b36 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -220,7 +220,7 @@ function App() { const retval: Array = []; if (!searchQuery) { - setSearchResults(retval); + setSearchResults([]); setSearchResultData({ type: 'FeatureCollection', features: [] @@ -229,7 +229,7 @@ function App() { } if (buildingPointData) { - let locationResults = buildingPointData.features.filter((e: any) => { + const locationResults = buildingPointData.features.filter((e: any) => { const includesName = e!.properties!.Name.toLowerCase().includes(searchQuery.toLowerCase()); const includesAbbr = e!.properties!.Abbrev.toLowerCase() === searchQuery.toLowerCase(); const includesBldgNum = e!.properties!.BldgNum.toLowerCase() === searchQuery.toLowerCase(); @@ -243,10 +243,10 @@ function App() { clearVisibility(); } - setSearchResults(retval); + setSearchResults([...retval]); setSearchResultData({ type: 'FeatureCollection', - features: retval + features: [...retval] }); }; diff --git a/src/components/SearchResults.tsx b/src/components/SearchResults.tsx index e0ce8a6..05ad278 100644 --- a/src/components/SearchResults.tsx +++ b/src/components/SearchResults.tsx @@ -74,7 +74,7 @@ export default function SearchResults(props: SearchResultsProps) {