diff --git a/app/javascript/controllers/lesson_toc_controller.js b/app/javascript/controllers/lesson_toc_controller.js index d4309a81d0..9dcd1b2ca9 100644 --- a/app/javascript/controllers/lesson_toc_controller.js +++ b/app/javascript/controllers/lesson_toc_controller.js @@ -16,6 +16,10 @@ export default class LessonTocController extends Controller { } disconnect() { + this.lessonContentTarget.querySelectorAll('section[id]').forEach((section) => { + this.tocItemObserver().unobserve(section); + }); + this.tocTarget.innerHTML = ''; }