I am loading markers depending on the bounding box. they come from an api via a pinia store. I am putting them in props field of my map wrapper component map-view. the markers are circlemarkers renderd via a vue-for loop.
when I move around on the map, the props field changes according to the state (itemsList) and so the vue-loop for the circlemarkers reloads the markers and new markers on the map. this works really nicely.
but after some time I found out, that when I click on a marker, a different marker-popup - than that of the clicked opens on that other mark. sometimes the whole map jumps to a completely different location because of this.
Is there any known problems with the order of markers and popups in leaflet, which leads to such problems? Can anybody imagine what makes that behavior? did I miss something?
here is my reduced vue map wrapper component:
<template>
<div id="main-map-wrapper">
<l-map ref="map" @update:bounds="updateBounds">
<l-circle-marker v-for="(item, index) in itemsList" :key="index">
<l-popup>{{item.name}}</l-popup>
<l-circle-marker>
</l-map>
</div>
</template>
<script>
import { LCircleMarker, LMap, LPopup } from "@vue-leaflet/vue-leaflet"
import {useItemsStore} from "@/store/itemsStore"; //pinia store
export default defineComponent({
name: "mapView",
components: {LCircleMarker, LMap, LPopup},
props: {
itemsList: Object
},
methods: {
updateBounds(bounds) {
useItemsStore.resetToBounds(bounds) //updates the itemsList, which comes from parent
}
}
}
</script>
So itemsList is reactive and comes from the parent component.
I am using vue3.