forge
Explore
Log in

Don't you dare go Hollow

🐛 exam room value reset on unchanged question

Browse files at this commit

a6eef00ba7f6e19830d97b3a15dd69b5875c6d4aBurak BoduroğluParent: f123ed2
  • fix
    • 🐛 exam room value reset on unchanged question
Show full message
fix: 🐛 exam room value reset on unchanged question
- guard createEffect with questionId check, only reset value on actual question change
src/components/exams/exam-room-ws.tsxmodified+3 -0
@@ -550,8 +550,11 @@ function QuestionAnswerCardWS(props: {
550550 : props.question.answer?.text ?? "",
551551 );
552552 const [saved, setSaved] = createSignal(false);
553+ let questionId = props.question.id;
553554
554555 createEffect(() => {
556+ if (props.question.id === questionId) return;
557+ questionId = props.question.id;
555558 setValue(
556559 props.question.kind === "choice"
557560 ? props.question.answer?.selected != null
src/components/exams/student-exam-room.tsxmodified+3 -0
@@ -259,8 +259,11 @@ function QuestionAnswerCard(props: {
259259 : props.question.answer?.text ?? "",
260260 );
261261 const [saved, setSaved] = createSignal(false);
262+ let questionId = props.question.id;
262263
263264 createEffect(() => {
265+ if (props.question.id === questionId) return;
266+ questionId = props.question.id;
264267 setValue(
265268 props.question.kind === "choice"
266269 ? props.question.answer?.selected != null