Remove manual reveal button and fix vote sync on session transitions
All checks were successful
Build & Push Container Image / build (push) Successful in 12s

Remove the "Reveal Votes" button since auto-reveal handles this. Add
poker:sync event so PokerRoom fetches current vote state on mount,
fixing checkmarks not appearing for other users on subsequent rounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jan Willem Mannaerts 2026-03-05 10:33:30 +01:00
parent 36c8c5f6f4
commit 0b713d3858
2 changed files with 16 additions and 12 deletions

View file

@ -256,6 +256,17 @@ io.on('connection', (socket) => {
} }
}); });
throttled('poker:sync', async ({ sessionId }) => {
try {
if (!sessionId) return;
const snapshot = await getSessionSnapshot(sessionId, socket.user.jiraCloudId);
if (!snapshot) return;
await emitSessionState(snapshot.session.roomId, sessionId, socket.user.jiraCloudId);
} catch (error) {
console.error('[socket] poker:sync failed:', error);
}
});
throttled('poker:vote', async ({ sessionId, vote }) => { throttled('poker:vote', async ({ sessionId, vote }) => {
try { try {
if (!sessionId) { if (!sessionId) {

View file

@ -29,6 +29,11 @@ export default function PokerRoom({ session, issue, user, members, roomId, onSav
const socket = useMemo(() => getSocket(), []); const socket = useMemo(() => getSocket(), []);
// Sync current vote state on mount (catches votes cast before this component rendered)
useEffect(() => {
socket.emit('poker:sync', { sessionId: session.id });
}, [session.id, socket]);
useEffect(() => { useEffect(() => {
function onVoteUpdate(payload) { function onVoteUpdate(payload) {
if (payload.sessionId !== session.id) return; if (payload.sessionId !== session.id) return;
@ -82,10 +87,6 @@ export default function PokerRoom({ session, issue, user, members, roomId, onSav
socket.emit('poker:kick', { roomId, userKey }); socket.emit('poker:kick', { roomId, userKey });
} }
function handleReveal() {
socket.emit('poker:reveal', { sessionId: session.id });
}
function handleSave() { function handleSave() {
const estimate = Number(manualEstimate || suggestedEstimate); const estimate = Number(manualEstimate || suggestedEstimate);
if (!Number.isFinite(estimate)) { if (!Number.isFinite(estimate)) {
@ -184,14 +185,6 @@ export default function PokerRoom({ session, issue, user, members, roomId, onSav
); );
})} })}
</div> </div>
{votedUserKeys.length > 0 && (
<button
onClick={handleReveal}
className="w-full bg-amber-500 hover:bg-amber-400 text-white font-semibold rounded-sm px-4 py-2 transition-colors cursor-pointer border-none text-sm"
>
Reveal Votes ({votedUserKeys.length}/{members.length})
</button>
)}
</div> </div>
)} )}
</div> </div>