Skip to content

Commit

Permalink
Remove null settings from fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkoisa committed Oct 4, 2023
1 parent 024435d commit b0824a7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/views/ServiceTreeView/ServiceTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ const ServiceTreeView = ({ intl, variant }) => {
// Do not fetch unit counts again for nodes that have the data, unless specified by fullSearch
const filteredIdList = fullSearch ? idList : idList.filter(id => !unitCounts.some(count => count.id === id))
const smAPI = new ServiceMapAPI();
const fetchOptions = {
organization: organizationSettings.map(setting => setting.id),
municipality: citySettings,
const fetchOptions = {};
if (organizationSettings.length) {
fetchOptions.organization = organizationSettings.map(setting => setting.id);
}
if (citySettings.length) {
fetchOptions.municipality = citySettings;
}
const counts = await Promise.all(
filteredIdList.map(async (id) => {
Expand Down

0 comments on commit b0824a7

Please sign in to comment.