From 383850aeb820ac2319ea7ffef2ee1782b9bbc54c Mon Sep 17 00:00:00 2001 From: raizasafeel <89463672+raizasafeel@users.noreply.github.com> Date: Wed, 28 Jan 2026 16:30:36 +0530 Subject: [PATCH] fix(quiz): questions list empty on back navigation from test quiz --- frontend/src/pages/QuizForm.vue | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/frontend/src/pages/QuizForm.vue b/frontend/src/pages/QuizForm.vue index dc8d753f..66ac87b5 100644 --- a/frontend/src/pages/QuizForm.vue +++ b/frontend/src/pages/QuizForm.vue @@ -226,7 +226,6 @@ import { onMounted, inject, onBeforeUnmount, - watch, } from 'vue' import { sessionStore } from '../stores/session' import { ClipboardList, ListChecks, Plus, Trash2 } from 'lucide-vue-next' @@ -252,7 +251,9 @@ const props = defineProps({ }, }) -const questions = ref([]) +const questions = computed(() => { + return quizDetails.doc?.questions || [] +}) onMounted(() => { if (!user.data?.is_moderator && !user.data?.is_instructor) { @@ -273,24 +274,10 @@ onBeforeUnmount(() => { window.removeEventListener('keydown', keyboardShortcut) }) -watch( - () => props.quizID !== 'new', - (newVal) => { - if (newVal) { - quizDetails.reload() - } - } -) - const quizDetails = createDocumentResource({ doctype: 'LMS Quiz', name: props.quizID, auto: false, - onSuccess(doc) { - if (doc.questions && doc.questions.length > 0) { - questions.value = doc.questions.map((question) => question) - } - }, }) const validateTitle = () => {