diff --git a/frontend/src/components/Notes/InlineLessonMenu.vue b/frontend/src/components/Notes/InlineLessonMenu.vue index ca815238..c753517c 100644 --- a/frontend/src/components/Notes/InlineLessonMenu.vue +++ b/frontend/src/components/Notes/InlineLessonMenu.vue @@ -162,7 +162,6 @@ const deleteHighlight = () => { const addToNotes = () => { if (!selectedText.value) return - console.log(selectedText.value) let noteToUpdate = notes.value?.data.find((note: Note) => { return !note.highlighted_text && note.note !== '' }) @@ -171,7 +170,6 @@ const addToNotes = () => { } else { updateNote(noteToUpdate) } - console.log(noteToUpdate) } const createNote = () => { diff --git a/frontend/src/components/Notes/Notes.vue b/frontend/src/components/Notes/Notes.vue index 99c0b997..2983bc4f 100644 --- a/frontend/src/components/Notes/Notes.vue +++ b/frontend/src/components/Notes/Notes.vue @@ -42,11 +42,13 @@ const updateCurrentNote = () => { const currentNote = notes.value?.data?.filter((row: Note) => { return !row.highlighted_text && row.note !== '' }) - if (!currentNote) return - if (currentNote.length > 0) { - currentNoteName.value = currentNote[0].name - note.value = currentNote[0].note + if (currentNote?.length === 0) { + note.value = null + currentNoteName.value = null + return } + currentNoteName.value = currentNote[0].name + note.value = currentNote[0].note } const updateNoteText = (val: string) => { diff --git a/frontend/src/pages/Lesson.vue b/frontend/src/pages/Lesson.vue index 567f3516..553bb3e9 100644 --- a/frontend/src/pages/Lesson.vue +++ b/frontend/src/pages/Lesson.vue @@ -532,7 +532,7 @@ watch( await nextTick() resetLessonState(newChapterNumber, newLessonNumber) startTimer() - notes.reload() + updateNotes() } } ) @@ -784,14 +784,12 @@ const scrollDiscussionsIntoView = () => { } const updateNotes = () => { - if (!notes.filters?.lesson) { - notes.update({ - filters: { - lesson: lesson.data?.name, - member: user.data?.name, - }, - }) - } + notes.update({ + filters: { + lesson: lesson.data?.name, + member: user.data?.name, + }, + }) notes.reload() }