Skip to content

Commit

Permalink
Always reset map pins when changing routes
Browse files Browse the repository at this point in the history
Prior to this commit, we only reset all pins styling when changing
between artwork detail pages. This meant going back to the index page
didn’t reset them, leaving the last highlighted pin highlighted.

Now, we reset them whenever the route changes, which is what we intend.

Issue #103 Highlighted map pin doesn't reset when returning to search
           results
  • Loading branch information
reefdog committed Sep 24, 2024
1 parent 8c5d381 commit 6701cb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions front-end/src/components/LeafletMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ onMounted(() => {
watch(
() => route.params.id,
(newId) => {
markerTable.forEach((marker) => {
marker.setIcon(defaultIcon);
marker.setZIndexOffset(0);
});
if (newId) {
markerTable.forEach((marker) => {
marker.setIcon(defaultIcon);
marker.setZIndexOffset(0);
});
const marker = markerTable.get(newId as string);
if (marker) {
marker.setIcon(activeIcon);
Expand Down

0 comments on commit 6701cb6

Please sign in to comment.