Skip to content

Commit

Permalink
fix: trigger map update when group selection changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Sep 16, 2024
1 parent b6ae9e2 commit 1db0c37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/scripts/controllers/map_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ angular.module("korpApp").directive("mapCtrl", [

$scope.toggleMarkerGroup = function (groupName: string) {
$scope.markerGroups[groupName].selected = !$scope.markerGroups[groupName].selected
// It is important to replace the array, not modify it, to trigger a watcher in the result-map component.
if ($scope.selectedGroups.includes(groupName)) {
$scope.selectedGroups.splice($scope.selectedGroups.indexOf(groupName), 1)
$scope.selectedGroups = $scope.selectedGroups.filter((group) => group != groupName)
} else {
$scope.selectedGroups.push(groupName)
$scope.selectedGroups = [...$scope.selectedGroups, groupName]
}
}

Expand Down

0 comments on commit 1db0c37

Please sign in to comment.