From 9afefdcf2f4a27f01ce10499b8c78730a00b9738 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Sat, 14 Dec 2024 14:25:23 +0100 Subject: [PATCH] docs: fix config --- docs/.vitepress/theme/index.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 958ba63..7fbf158 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -29,19 +29,18 @@ export default { () => nextTick(() => { scrollToActiveSidebarItem(); - }), - { - immediate: true, - } + }) ); }, } satisfies Theme; function scrollToActiveSidebarItem() { - setTimeout(() => { - const activeLink = document.querySelector('#VPSidebarNav div.is-link.is-active.has-active'); - if (activeLink) { - activeLink.scrollIntoView({ behavior: 'smooth', block: 'center' }); - } - }, 1000); + if (typeof window !== 'undefined') { + setTimeout(() => { + const activeLink = document.querySelector('#VPSidebarNav div.is-link.is-active.has-active'); + if (activeLink) { + activeLink.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } + }, 1000); + } }