Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta Para iniciantes
#175 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
72/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
next.js, react, typescript
Domínio
frontend, networking

Direção de pesquisa

Comece por apps/frontend/src/screens/LiveQuiz.tsx, especialmente por handleAnswer, handleStart, handleNext e pela lógica disabled dos botões de resposta. Verifique o estado ready do WebSocket antes de atualizar o estado da resposta selecionada ou enviá-la e torne as falhas visíveis para participantes e hosts; a issue deixa em aberto escolher entre rejeitar e enfileirar as perguntas sem resposta. Verifique se uma conexão com falha não pode exibir uma resposta como enviada e se os controles do host mostram a mesma falha.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
TypeScript
Estrelas
21
Forks
7
Merge médio
4h 13min
PRs com merge (30d)
20

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TheCodeHeist-Coder/Rexial

Todas as issues de TheCodeHeist-Coder/Rexial

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.