diff --git a/packages/map-template/CHANGELOG.md b/packages/map-template/CHANGELOG.md index c4c646683..869d0501d 100644 --- a/packages/map-template/CHANGELOG.md +++ b/packages/map-template/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.70.0] - 2024-12-10 + +### Added + +- Limit the maximum number of search results to 100 to improve render performance. + +### Fixed +- Fixed a bug where the selected venue (in case no venue was set otherwise) was picked alphabetically by Administrative ID rather than the displayed Venue name. ## [1.59.0] - 2024-11-26 ### Added diff --git a/packages/map-template/src/components/Search/Search.jsx b/packages/map-template/src/components/Search/Search.jsx index 5e083d31e..4ff60cc18 100644 --- a/packages/map-template/src/components/Search/Search.jsx +++ b/packages/map-template/src/components/Search/Search.jsx @@ -57,6 +57,9 @@ function Search({ onSetSize, isOpen }) { /** Referencing the keyboard element */ const keyboardRef = useRef(); + /** Maximum number of search results to show */ + const MAX_RESULTS = 100; + const [searchDisabled, setSearchDisabled] = useState(true); const [searchResults, setSearchResults] = useRecoilState(searchResultsState); const categories = useRecoilValue(categoriesState); @@ -137,9 +140,11 @@ function Search({ onSetSize, isOpen }) { * @param {array} locations */ function onResults(locations) { - setSearchResults(locations); - setFilteredLocations(locations); - setShowNotFoundMessage(locations.length === 0); + const displayResults = locations.slice(0, MAX_RESULTS); + + setSearchResults(displayResults); + setFilteredLocations(displayResults); + setShowNotFoundMessage(displayResults.length === 0); // Handles updates to scroll buttons when the category changes. // When a category changes, the scroll buttons need to have their enabled/disabled states updated. diff --git a/packages/map-template/src/hooks/useCurrentVenue.js b/packages/map-template/src/hooks/useCurrentVenue.js index 84d45a9ae..8139e4f8d 100644 --- a/packages/map-template/src/hooks/useCurrentVenue.js +++ b/packages/map-template/src/hooks/useCurrentVenue.js @@ -74,7 +74,7 @@ export const useCurrentVenue = () => { } // Else take first venue sorted alphabetically - return [...venuesInSolution].sort(function (a, b) { return (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0); })[0]; + return [...venuesInSolution].sort(function (a, b) { return (a.venueInfo.name > b.venueInfo.name) ? 1 : ((b.venueInfo.name > a.venueInfo.name) ? -1 : 0); })[0]; }; /**