fix: Behebt Endlosschleife und doppelte Recoil-Atom-Registrierung
- `index.js` als Client-Komponente deklariert (`"use client"`) zur Vermeidung von SSR-Problemen. - `useEffect` optimiert, um unendliche API-Requests durch `isMounted`-Check zu verhindern. - `loadData()` angepasst, um API-Fehler korrekt abzufangen und erneute Ladeversuche zu vermeiden. - Doppelte Registrierung von `poiReadFromDbTriggerAtom` durch HMR verhindert. - Ungültige MySQL-Option `acquireTimeout` entfernt, um Verbindungsfehler zu beheben. Diese Änderungen verhindern unerwartete Reloads und verbessern die Stabilität der Anwendung.
This commit is contained in:
@@ -7,7 +7,6 @@ import { toast } from "react-toastify";
|
||||
import * as config from "../config/config.js";
|
||||
import { disablePolylineEvents, enablePolylineEvents } from "./setupPolylines"; // Importiere die Funktion zum Deaktivieren der Polyline-Ereignisse
|
||||
import { setPolylineEventsDisabled } from "../store/atoms/polylineEventsDisabledState"; // Importiere den Recoil-Atom-Zustand
|
||||
import { SERVER_URL } from "../config/urls.js";
|
||||
|
||||
// Funktion zum Bestimmen der Priorität basierend auf dem Icon-Pfad
|
||||
const determinePriority = (iconPath, priorityConfig) => {
|
||||
@@ -32,15 +31,13 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
|
||||
const jsonResponse = await response1.json();
|
||||
const response2 = await fetch(config.mapGisStationsStatusDistrictUrl);
|
||||
const statusResponse = await response2.json();
|
||||
const BASE_URL = SERVER_URL;
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
|
||||
|
||||
const getIdSystemAndAllowValueMap = new Map(GisSystemStatic.map((system) => [system.IdSystem, system.Allow]));
|
||||
|
||||
if (jsonResponse.Points && statusResponse.Statis) {
|
||||
//console.log("jsonResponse.Points: ", jsonResponse.Points);
|
||||
//console.log("statusResponse.Statis: ", statusResponse.Statis);
|
||||
localStorage.setItem("jsonResponse.Points", JSON.stringify(jsonResponse.Points));
|
||||
localStorage.setItem("statusResponse.Statis", JSON.stringify(statusResponse.Statis));
|
||||
console.log("jsonResponse.Points: ", jsonResponse.Points);
|
||||
console.log("statusResponse.Statis: ", statusResponse.Statis);
|
||||
const statisMap = new Map(statusResponse.Statis.map((s) => [s.IdLD, s]));
|
||||
let markersData = jsonResponse.Points.filter((station) => station.System === systemId && getIdSystemAndAllowValueMap.get(station.System) === 1).map((station) => {
|
||||
const statis = statisMap.get(station.IdLD);
|
||||
@@ -114,6 +111,7 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
|
||||
</div>
|
||||
`);
|
||||
|
||||
|
||||
return marker;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user