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:
@@ -1,7 +1,16 @@
|
||||
//store/selectors/readPoiMarkersStore.js
|
||||
import { atom } from 'recoil';
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const readPoiMarkersStore = atom({
|
||||
key: 'readPoiMarkersStore',
|
||||
default: [],
|
||||
});
|
||||
const storeKey = "readPoiMarkersStore";
|
||||
|
||||
// Verhindert doppelte Registrierung bei HMR
|
||||
export const readPoiMarkersStore =
|
||||
globalThis.readPoiMarkersStore ||
|
||||
atom({
|
||||
key: storeKey,
|
||||
default: [],
|
||||
});
|
||||
|
||||
// Speichert das Atom im globalen Namespace (nur in Dev)
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalThis.readPoiMarkersStore = readPoiMarkersStore;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user