Fix/answer dropped before run init - #170
Merged
Merged
Conversation
An answer selected while CurrentQuizActor.state.run was undefined was
silently discarded: LogAnswer's body is wrapped in `if (this.state.run)`
with no else, and the student answer UI was clickable during the run
(re)initialisation window (e.g. the startup WS reconnect clears `run` and
the async GetRun re-fetch stalls on the ts-actors 5s ask-timeout).
- LogAnswer: buffer the pending {questionId, answer} in state.pendingAnswer
instead of no-oping when run is undefined; new flushPendingAnswer() replays
it once run + questions are ready (from GetRun, StartQuiz, SetQuiz-same,
QuestionUpdate). Buffer cleared on Reset/SetQuiz-different/QuizRunDeleted.
- QuizPage: gate the student answer UI (RunningQuizTab) on run present +
hasInitialQuestions so a question isn't answerable before the run exists.
Scoped to that branch (not page-wide) so teacher tabs still render without
a run while editing; keyed on `run` rather than the unreliable runReady flag.
- Add CurrentQuizActor unit test covering buffer + replay.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a race where an answer selected during the quiz run's (re)initialisation window was silently discarded — e.g. a startup WebSocket reconnect clears run and the async GetRun re-fetch stalls on the ts-actors 5 s ask-timeout, leaving the answer UI clickable while LogAnswer no-ops.
Changes
Verified on the test server. Backend and models unchanged.