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:
parent
bdd6e2c691
commit
d77dac74a2
|
|
@ -1490,7 +1490,20 @@ export function usePostsEngine({
|
||||||
const map = mapRef.current;
|
const map = mapRef.current;
|
||||||
const overlay = map?.__swCenteredOverlay;
|
const overlay = map?.__swCenteredOverlay;
|
||||||
if (overlay && overlay.postId === postId) {
|
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.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;
|
map.__swCenteredOverlay = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue