Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

A participant's answer is silently lost when their connection drops

未关闭 适合新手
#175 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃

调研方向

从 apps/frontend/src/screens/LiveQuiz.tsx 开始,重点关注 handleAnswer、handleStart、handleNext 以及答题按钮的 disabled 逻辑。在更新所选答案的状态或发送答案之前,检查 WebSocket 的就绪状态,并让参与者和主持人都能看到失败;该 issue 没有决定是拒绝未作答的答案,还是将其加入队列。验证连接失败时不会将答案显示为已提交,并验证主持人控件也会显示相同的失败。

由索引模型根据 Issue 内容生成。

描述

bug help wanted UI & UX

In apps/frontend/src/screens/LiveQuiz.tsx, the answer buttons are disabled only by whether an answer is already chosen:

// line ~739
disabled={Boolean(selectedAnswer) || showResults}

They are never disabled by connectionState. handleAnswer then sends with an optional chain:

// line ~414
setSelectedAnswer(answerId);            // the UI locks in immediately
const timeMs = Date.now() - questionStartTime;
ws?.send(JSON.stringify({ ... }))       // no-ops silently on a dead socket

So after the reconnect attempts are exhausted (connectionState === "failed", the red banner showing), tapping an answer still works: selectedAnswer is set, the button renders as chosen, and nothing is sent. No throw, no error.

Why it matters

The player sees their answer highlighted as submitted and waits for results. It never reached the server, so they score 0 for that question — and for every question after, since the socket is still dead. The only clue is a banner they have most likely stopped noticing.

In a graded quiz this silently destroys someone's score.

handleStart and handleNext have the same unguarded ws?.send, so a host pressing Start or Next on a failed connection also gets no feedback.

What a fix looks like
  • Disable the answer buttons when connectionState !== "connected", with a visible reason rather than just the banner.
  • Make the send path explicit about failure: check ws?.readyState === WebSocket.OPEN before sending, and surface something to the user when it is not.
  • Decide what should happen to an answer chosen while disconnected — queue it for the reconnect, or refuse the tap outright. Say which you chose in the PR.
Definition of done
  • An answer cannot be visually "submitted" when it could not be sent
  • The participant is told their connection is the problem, at the moment they try
  • Host controls behave the same way
主要语言
TypeScript
星标
21
派生
7
平均合并
3 小时 39 分钟
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TheCodeHeist-Coder/Rexial 的其他 Issue

查看 TheCodeHeist-Coder/Rexial 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。