From 5498b3773b55ec8963415b8177ac5a9a0bf33b46 Mon Sep 17 00:00:00 2001 From: trancen Date: Tue, 3 Feb 2026 18:46:02 +0000 Subject: [PATCH] fix: WSPR infinite cleanup loop + earthquake marker debug logging WSPR: - Added guard to prevent cleanup when no controls exist - Stops infinite '[WSPR] Plugin disabled' console spam - Only cleans up if controls are actually present Earthquakes: - Added detailed logging for each marker creation - Logs: quakeId, lat, lon, size, color - Will help identify if markers are being positioned correctly --- src/plugins/layers/useEarthquakes.js | 1 + src/plugins/layers/useWSPR.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/plugins/layers/useEarthquakes.js b/src/plugins/layers/useEarthquakes.js index bbd3bef..ce1d310 100644 --- a/src/plugins/layers/useEarthquakes.js +++ b/src/plugins/layers/useEarthquakes.js @@ -112,6 +112,7 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) { iconAnchor: [size/2, size/2] }); + console.log('Creating earthquake marker:', quakeId, 'at', lat, lon, 'size:', size, 'color:', color); const circle = L.marker([lat, lon], { icon, opacity }); // Add to map first diff --git a/src/plugins/layers/useWSPR.js b/src/plugins/layers/useWSPR.js index 1f8b242..7fd6f0c 100644 --- a/src/plugins/layers/useWSPR.js +++ b/src/plugins/layers/useWSPR.js @@ -973,6 +973,14 @@ export function useLayer({ enabled = false, opacity = 0.7, map = null }) { // Cleanup controls on disable - FIX: properly remove all controls and layers useEffect(() => { if (!enabled && map) { + // Only log once and check if controls actually exist before attempting removal + const hasControls = filterControlRef.current || legendControlRef.current || + statsControlRef.current || chartControlRef.current; + + if (!hasControls) { + return; // Nothing to clean up + } + console.log('[WSPR] Plugin disabled - cleaning up all controls and layers'); // Remove filter control