diff --git a/docs/.vitepress/theme/components/icons/CategoryList.vue b/docs/.vitepress/theme/components/icons/CategoryList.vue
index 9aeac8178..8ebfc161f 100644
--- a/docs/.vitepress/theme/components/icons/CategoryList.vue
+++ b/docs/.vitepress/theme/components/icons/CategoryList.vue
@@ -1,5 +1,5 @@
diff --git a/docs/.vitepress/theme/composables/useActiveAnchor.ts b/docs/.vitepress/theme/composables/useActiveAnchor.ts
index ac30e7bf8..2a7413eaa 100644
--- a/docs/.vitepress/theme/composables/useActiveAnchor.ts
+++ b/docs/.vitepress/theme/composables/useActiveAnchor.ts
@@ -20,6 +20,8 @@ export function useActiveAnchor(container, marker) {
window.removeEventListener('scroll', setActiveLinkDebounced);
});
function setActiveLink() {
+ // Can run from a debounced scroll handler or a timeout after the component unmounted.
+ if (!container.value) return;
const links = [].slice.call(container.value.querySelectorAll('.outline-link'));
const anchors = [].slice
.call(document.querySelectorAll('.content .header-anchor'))
@@ -48,6 +50,7 @@ export function useActiveAnchor(container, marker) {
}
}
function activateLink(hash) {
+ if (!container.value || !marker.value) return;
if (prevActiveLink) {
prevActiveLink.classList.remove('active');
}