🐛 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 | : props.question.answer?.text ?? "", | 550 | : props.question.answer?.text ?? "", |
| 551 | ); | 551 | ); |
| 552 | const [saved, setSaved] = createSignal(false); | 552 | const [saved, setSaved] = createSignal(false); |
| 553 | + let questionId = props.question.id; | ||
| 553 | 554 | ||
| 554 | createEffect(() => { | 555 | createEffect(() => { |
| 556 | + if (props.question.id === questionId) return; | ||
| 557 | + questionId = props.question.id; | ||
| 555 | setValue( | 558 | setValue( |
| 556 | props.question.kind === "choice" | 559 | props.question.kind === "choice" |
| 557 | ? props.question.answer?.selected != null | 560 | ? props.question.answer?.selected != null |
src/components/exams/student-exam-room.tsxmodified+3 -0
| @@ -259,8 +259,11 @@ function QuestionAnswerCard(props: { | |||
| 259 | : props.question.answer?.text ?? "", | 259 | : props.question.answer?.text ?? "", |
| 260 | ); | 260 | ); |
| 261 | const [saved, setSaved] = createSignal(false); | 261 | const [saved, setSaved] = createSignal(false); |
| 262 | + let questionId = props.question.id; | ||
| 262 | 263 | ||
| 263 | createEffect(() => { | 264 | createEffect(() => { |
| 265 | + if (props.question.id === questionId) return; | ||
| 266 | + questionId = props.question.id; | ||
| 264 | setValue( | 267 | setValue( |
| 265 | props.question.kind === "choice" | 268 | props.question.kind === "choice" |
| 266 | ? props.question.answer?.selected != null | 269 | ? props.question.answer?.selected != null |