🐛 exam room value reset on unchanged question
Browse files at this commita6eef00ba7f6e19830d97b3a15dd69b5875c6d4aParent: f123ed2- fix
- 🐛 exam room value reset on unchanged question
2 changed files +6 -0
src/components/exams/exam-room-ws.tsxmodified+3 -0
| @@ -550,8 +550,11 @@ function QuestionAnswerCardWS(props: { | ||
| 550 | 550 | : props.question.answer?.text ?? "", |
| 551 | 551 | ); |
| 552 | 552 | const [saved, setSaved] = createSignal(false); |
| 553 | + let questionId = props.question.id; | |
| 553 | 554 | |
| 554 | 555 | createEffect(() => { |
| 556 | + if (props.question.id === questionId) return; | |
| 557 | + questionId = props.question.id; | |
| 555 | 558 | setValue( |
| 556 | 559 | props.question.kind === "choice" |
| 557 | 560 | ? props.question.answer?.selected != null |
src/components/exams/student-exam-room.tsxmodified+3 -0
| @@ -259,8 +259,11 @@ function QuestionAnswerCard(props: { | ||
| 259 | 259 | : props.question.answer?.text ?? "", |
| 260 | 260 | ); |
| 261 | 261 | const [saved, setSaved] = createSignal(false); |
| 262 | + let questionId = props.question.id; | |
| 262 | 263 | |
| 263 | 264 | createEffect(() => { |
| 265 | + if (props.question.id === questionId) return; | |
| 266 | + questionId = props.question.id; | |
| 264 | 267 | setValue( |
| 265 | 268 | props.question.kind === "choice" |
| 266 | 269 | ? props.question.answer?.selected != null |