Fix modal flash when clicking actions (vote, like, etc.)

- 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 <noreply@anthropic.com>
This commit is contained in:
SocioWire 2026-01-11 03:17:40 +00:00
parent d60a7e373e
commit e89f53d1eb
2 changed files with 9 additions and 3 deletions

View File

@ -1964,8 +1964,8 @@ export function openCenteredOverlay({ map, post, theme, fullScreen = false }) {
}; };
const voteUp = rail.querySelector(".sw-truth-rail-btn-up"); const voteUp = rail.querySelector(".sw-truth-rail-btn-up");
const voteDown = rail.querySelector(".sw-truth-rail-btn-down"); const voteDown = rail.querySelector(".sw-truth-rail-btn-down");
if (voteUp) voteUp.addEventListener("click", () => doVote("true")); if (voteUp) voteUp.addEventListener("click", (e) => { e.stopPropagation(); doVote("true"); });
if (voteDown) voteDown.addEventListener("click", () => doVote("false")); if (voteDown) voteDown.addEventListener("click", (e) => { e.stopPropagation(); doVote("false"); });
} }
applyAuthUI(); applyAuthUI();

View File

@ -1427,8 +1427,14 @@ export function usePostsEngine({
} }
if (changed) { if (changed) {
allPostsRef.current = updated; allPostsRef.current = updated;
// 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); refreshVisibleAndMarkers(timeHours, true);
} }
}
}; };
const needsResolve = (value) => const needsResolve = (value) =>