fix(devices): Duplikate im Kontextmenü "Station öffnen" behoben

- Mehrfaches Hinzufügen bei jedem Rechtsklick unterbunden
- Kontextmenü-Initialisierung mit contextMenuCreated abgesichert
- Datei: createAndSetDevices.js
This commit is contained in:
ISA
2025-05-27 14:45:58 +02:00
parent a19bf96843
commit 40afadb178
4 changed files with 46 additions and 7 deletions

View File

@@ -4,6 +4,20 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie
---
## [1.1.191] 2025-05-27
### 🐞 Fixed
- Fehler behoben: Kontextmenü „Station öffnen (Tab)“ wurde bei Geräten/Stationen mehrfach angezeigt
- Ursache war doppelte Registrierung bei jedem Rechtsklick jetzt mit `contextMenuCreated`-Flag verhindert
- Datei `createAndSetDevices.js` entsprechend angepasst
### 🔧 Version
- 📦 Version erhöht auf **1.1.191**
---
[1.1.190] 2025-05-27
🐞 Fixed
Dropdown im UI Widget MapLayersControlPanel zeigte keine Stations-/Bereichsnamen an

14
bugs.md
View File

@@ -1,13 +1,17 @@
# 🐛 Aktuelle Bugs
## 1. Stationen Dropdown leer
## ✅ Gelöste Probleme
### 1. Stationen Dropdown leer
- [x] Webservice-Aufruf überprüfen (`fetchGisStationsStaticDistrict`)
- [x] Redux-State prüfen (`selectGisStationsStaticDistrict`)
- [x] basePath in `.env.local` korrekt?
- ✅ Gelöst am 27.05.2025 in Version 1.1.190
## 2. Kontextmenü dupliziert
### 2. Kontextmenü dupliziert bei Geräten
- [ ] Wird Kontextmenü mehrfach erzeugt?
- [ ] Wird cleanup in `useMapContextMenu` korrekt durchgeführt?
- [ ] Test: `Rechtsklick > Station öffnen Tab`
- [x] Wird Kontextmenü mehrfach erzeugt?
- [x] Wird cleanup in `useMapContextMenu` korrekt durchgeführt?
- [x] Test: `Rechtsklick > Station öffnen Tab`
- ✅ Gelöst am 27.05.2025 in Version 1.1.191 (`createAndSetDevices.js`)

View File

@@ -1,2 +1,2 @@
// /config/appVersion
export const APP_VERSION = "1.1.191";
export const APP_VERSION = "1.1.192";

View File

@@ -118,10 +118,31 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
}
};
let contextMenuCreated = false;
marker.on("contextmenu", (event) => {
event.originalEvent?.preventDefault();
marker.openPopup();
addDeviceContextMenu(map, marker);
if (!contextMenuCreated) {
contextMenuCreated = true;
marker.bindContextMenu({
contextmenu: true,
contextmenuWidth: 160,
contextmenuItems: [
{ separator: true },
{
text: "Station öffnen (Tab)",
icon: "/img/screen_new.png",
callback: () => {
const link = `${window.location.origin}${basePath}/cpl.aspx?ver=35&kue=24&id=${station.IdLD}`;
window.open(link, "_blank");
},
},
],
});
}
});
map.on("click", () => {