fix: restore map interactions after post deletion

When a post was deleted while viewing it, the map interactions (drag, zoom)
were not being restored, leaving the map frozen.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
SocioWire 2026-01-09 05:03:19 +00:00
parent bdd6e2c691
commit d77dac74a2
1 changed files with 13 additions and 0 deletions

View File

@ -1490,7 +1490,20 @@ export function usePostsEngine({
const map = mapRef.current;
const overlay = map?.__swCenteredOverlay;
if (overlay && overlay.postId === postId) {
// Remove event listeners
try { if (overlay.onKey) window.removeEventListener("keydown", overlay.onKey); } catch {}
try { if (overlay.onAuth) window.removeEventListener("sociowire:auth-changed", overlay.onAuth); } catch {}
// Remove overlay element
try { overlay.el?.remove?.(); } catch {}
try { overlay.backdrop?.remove?.(); } catch {}
// Restore map interactions
const st = overlay.interactionState || {};
try {
if (st.dragPan) map.dragPan?.enable?.();
if (st.scrollZoom) map.scrollZoom?.enable?.();
if (st.doubleClickZoom) map.doubleClickZoom?.enable?.();
if (st.touchZoomRotate) map.touchZoomRotate?.enable?.();
} catch {}
map.__swCenteredOverlay = null;
}