From d4a0f78cd02b5a6fa23ac95e57bec0d421c3d90d Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 20 Jan 2026 00:14:05 +0100 Subject: [PATCH] Implement watchers for courseId and lessonId in VocabLessonView to reset flags on changes - Added watchers for courseId and lessonId to reset flags related to lesson completion and navigation when either value changes, ensuring proper lesson loading and state management. - Removed redundant method definitions for courseId and lessonId, streamlining the component's code structure and improving maintainability. --- frontend/src/views/social/VocabLessonView.vue | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index 3108d74..7423bd7 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -414,6 +414,24 @@ export default { } } }, + watch: { + courseId(newVal, oldVal) { + if (newVal !== oldVal) { + // Reset Flags beim Kurswechsel + this.isCheckingLessonCompletion = false; + this.isNavigatingToNext = false; + this.loadLesson(); + } + }, + lessonId(newVal, oldVal) { + if (newVal !== oldVal) { + // Reset Flags beim Lektionswechsel + this.isCheckingLessonCompletion = false; + this.isNavigatingToNext = false; + this.loadLesson(); + } + } + }, methods: { _extractVocabFromExercises(exercises) { // Sicherstellen, dass exercises ein Array ist @@ -530,24 +548,6 @@ export default { console.log(`[_extractVocabFromExercises] Ergebnis:`, result.length, 'Vokabeln'); return result; }, - courseId(newVal, oldVal) { - if (newVal !== oldVal) { - // Reset Flags beim Kurswechsel - this.isCheckingLessonCompletion = false; - this.isNavigatingToNext = false; - this.loadLesson(); - } - }, - lessonId(newVal, oldVal) { - if (newVal !== oldVal) { - // Reset Flags beim Lektionswechsel - this.isCheckingLessonCompletion = false; - this.isNavigatingToNext = false; - this.loadLesson(); - } - } - }, - methods: { async loadLesson() { // Verhindere mehrfaches Laden if (this.loading) {