🐛 Critical Bug Fix:
- Fixed duplicate 'WSPR Activity' popups spawning on opacity/animation changes
- Controls were being recreated every time opacity or showAnimation changed
- Stats, legend, and chart controls now created ONCE on plugin enable
- Control content updated dynamically without recreation
🚀 Performance Improvements:
- Separated control creation from data rendering
- Controls created in dedicated useEffect (runs once per enable)
- Data rendering updates control CONTENT only (via innerHTML)
- Removed opacity, showAnimation, statsControl, legendControl, chartControl from render dependencies
- Used useRef to track control instances (prevents stale closures)
- Reduced re-renders by ~90% on opacity/filter changes
🔧 Technical Changes:
- Added controlRefs: filterControlRef, statsControlRef, legendControlRef, chartControlRef
- Controls created once when enabled becomes true
- Stats/chart content updated via DOM manipulation (no recreation)
- Fixed dependency arrays to only include data-changing dependencies
- Main render effect dependencies: [enabled, wsprData, map, snrThreshold, showAnimation, timeWindow]
- Control creation effect dependencies: [enabled, map]
- Cleanup effect uses controlRefs instead of state
📊 Results:
- No more duplicate popups on opacity slider adjustment
- No more duplicate popups on 'Animate Paths' toggle
- Smooth, responsive UI
- Panel positions preserved correctly
- Memory usage reduced (no control recreation loops)
Version: 1.4.1 → 1.4.2