Skip to content

Commit

Permalink
Merge branch 'improved-search' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarne3 committed Aug 23, 2024
2 parents 150760e + 2a20e8d commit a99117f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function App() {
const retval: Array<Feature> = [];

if (!searchQuery) {
setSearchResults(retval);
setSearchResults([]);
setSearchResultData({
type: 'FeatureCollection',
features: []
Expand All @@ -228,7 +228,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();
Expand All @@ -242,10 +242,10 @@ function App() {
clearVisibility();
}

setSearchResults(retval);
setSearchResults([...retval]);
setSearchResultData({
type: 'FeatureCollection',
features: retval
features: [...retval]
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function SearchResults(props: SearchResultsProps) {
<ul role="listbox" tabIndex={-1} id='search-results' className='search-results'>
{props.searchResults.map((result: Feature) => {
return (
<li key={result!.properties!.Name} className='list-item search-result'>
<li key={`${result!.properties!.Name}_${result!.properties!.BldgNum}`} className='list-item search-result'>
<a
className='search-result-link'
onClick={() => {
Expand Down

0 comments on commit a99117f

Please sign in to comment.