Skip to content

Commit ab7bc5b

Browse files
committed
fix error logic about answer-area
1 parent 6d3b962 commit ab7bc5b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,20 @@ export default function Page() {
172172
}
173173

174174
const onNextQuestion = useCallback(async () => {
175+
// Reset answer states when getting a new question
175176
setUserAnswer({ content: "" });
176177
setIsSubmitted(false);
177178
setTimeRemaining(600);
178179
setIsLoadingQuestion(true);
179180
// Reset timer state
180181
setIsTimerRunning(false);
181182

183+
// Close any open answer displays
184+
setShowAnswerModal(false);
185+
setShowInlineAnswer(false);
186+
setAnswer(null);
187+
setParsedAnswer(null);
188+
182189
try {
183190
const question = await generateRandomQuestion();
184191
setCurrentQuestion(question);
@@ -323,6 +330,12 @@ export default function Page() {
323330
})
324331
}
325332

333+
// Close any open answer displays before moving to the next question
334+
setShowAnswerModal(false);
335+
setShowInlineAnswer(false);
336+
setAnswer(null);
337+
setParsedAnswer(null);
338+
326339
// Move to the next question
327340
onNextQuestion()
328341
}, [currentQuestion, onNextQuestion, toast, t])

0 commit comments

Comments
 (0)