Fix bug which prevented last marker being removed from the map if deleted
This commit is contained in:
parent
7fbe2351f2
commit
3b632dea85
|
@ -231,11 +231,15 @@
|
||||||
titleKey,
|
titleKey,
|
||||||
onClick
|
onClick
|
||||||
) => {
|
) => {
|
||||||
if (!mapInstance || !validRows?.length) {
|
if (!mapInstance) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mapMarkerGroup.clearLayers()
|
mapMarkerGroup.clearLayers()
|
||||||
|
if (!validRows?.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
validRows.forEach(row => {
|
validRows.forEach(row => {
|
||||||
let markerCoords = [row[latKey], row[lngKey]]
|
let markerCoords = [row[latKey], row[lngKey]]
|
||||||
let marker = L.marker(markerCoords, mapMarkerOptions).addTo(mapInstance)
|
let marker = L.marker(markerCoords, mapMarkerOptions).addTo(mapInstance)
|
||||||
|
|
Loading…
Reference in New Issue