From e89f53d1eb0219ae7a573013ebefa6ea7951dd8d Mon Sep 17 00:00:00 2001 From: SocioWire Date: Sun, 11 Jan 2026 03:17:40 +0000 Subject: [PATCH] Fix modal flash when clicking actions (vote, like, etc.) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Skip marker refresh when post modal is open (update UI in-place) - Add stopPropagation to vote buttons to prevent event bubbling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/components/Map/markerManager.js | 4 ++-- src/components/Map/usePostsEngine.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/Map/markerManager.js b/src/components/Map/markerManager.js index 0333420..8af6da9 100644 --- a/src/components/Map/markerManager.js +++ b/src/components/Map/markerManager.js @@ -1964,8 +1964,8 @@ export function openCenteredOverlay({ map, post, theme, fullScreen = false }) { }; const voteUp = rail.querySelector(".sw-truth-rail-btn-up"); const voteDown = rail.querySelector(".sw-truth-rail-btn-down"); - if (voteUp) voteUp.addEventListener("click", () => doVote("true")); - if (voteDown) voteDown.addEventListener("click", () => doVote("false")); + if (voteUp) voteUp.addEventListener("click", (e) => { e.stopPropagation(); doVote("true"); }); + if (voteDown) voteDown.addEventListener("click", (e) => { e.stopPropagation(); doVote("false"); }); } applyAuthUI(); diff --git a/src/components/Map/usePostsEngine.js b/src/components/Map/usePostsEngine.js index b12cd12..37d0a4a 100644 --- a/src/components/Map/usePostsEngine.js +++ b/src/components/Map/usePostsEngine.js @@ -1427,7 +1427,13 @@ export function usePostsEngine({ } if (changed) { allPostsRef.current = updated; - refreshVisibleAndMarkers(timeHours, true); + // Skip full marker refresh if this post's modal is open - we update UI in-place below + const map = mapRef.current; + const ov = map?.__swCenteredOverlay; + const isModalOpen = ov && ov.postId === postId; + if (!isModalOpen) { + refreshVisibleAndMarkers(timeHours, true); + } } };