[Bug]: Poll voter loses their "You voted" state as soon as someone else votes

オープン
#282 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@daocuong11 がすでに取り組んでいます。

2026年11月28日 から。

  • #285 @daocuong11 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript

調査の方向性

Start by tracing sanitizePoll in apps/ws-server/src/utils/pollManager.ts and the poll:updated/poll:ended broadcasts in apps/ws-server/src/utils/handleMessages.ts; then follow the poll update handler in apps/frontend/src/screens/LiveQuiz.tsx and how ActivePollOverlay.tsx uses votedOptionId. Add coverage for a player voting followed by another player's update, and check that the vote selection and results remain visible through poll updates and ending.

索引モデルが issue の本文から書いたものです。

説明

level2 nsoc26

What happens

I vote in a live poll and see "You voted" with the results. When the next person votes, my screen goes back to the unvoted view with the Vote buttons, and the results are hidden again. Tapping an option then sends a second vote, which the server refuses with ALREADY_VOTED, and the screen does not show anything. In a room with many players this happens on almost every vote. The "Your Vote" mark is also lost when the poll ends.

Why

  • apps/ws-server/src/utils/pollManager.ts:76: sanitizePoll sets votedOptionId: null when it is called without a participant id.
  • apps/ws-server/src/utils/handleMessages.ts:733-735: poll:updated is broadcast to the whole session without a participant id (same for poll:ended).
  • apps/frontend/src/screens/LiveQuiz.tsx:407-414: the client does { ...prev, ...payload.poll }, so that null overwrites the voter's saved choice.
  • ActivePollOverlay.tsx uses votedOptionId to decide whether to show results.

Steps to reproduce

  1. Host a quiz, join with two players, launch a poll.
  2. Player A votes. A sees "You voted".
  3. Player B votes. A is back to the Vote buttons.

I reproduced both sides with a throwaway vitest test (Redis and Prisma faked on the server, fake WebSocket on the frontend). Messages A receives are poll:updated (null), poll:voted (option), poll:updated (null), and after the last one the screen shows "Tap an option above to submit your vote!".

Expected

A player's own choice stays selected until a new poll starts.

Suggested fix

Leave votedOptionId out of broadcast payloads (only include it when a participant id is passed), or keep prev.votedOptionId in the client when the poll id is the same. Add a test for vote, then someone else's update.

I can fix this one if you assign it to me.

主要言語
TypeScript
スター
21
フォーク
7
平均マージ
11時間 14分
マージ済み PR(30日)
30

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TheCodeHeist-Coder/Rexial のほかの issue

TheCodeHeist-Coder/Rexial の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。