From 1769d329cc1f517136d9a543385edce335e5dd24 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:44:15 +0530 Subject: [PATCH] refactor: directly use first child instead of querying --- src/client/app/router.ts | 2 +- src/client/theme-default/components/VPLocalSearchBox.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 023a1803..42f12021 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -290,7 +290,7 @@ function handleHMR(route: Route): void { // update route.data on HMR updates of active page if (import.meta.hot) { // hot reload pageData - import.meta.hot!.on('vitepress:pageData', (payload: PageDataPayload) => { + import.meta.hot.on('vitepress:pageData', (payload: PageDataPayload) => { if (shouldHotReload(payload)) { route.data = payload.pageData } diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 75f073bb..29671e84 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -194,7 +194,7 @@ debouncedWatch( ?.scrollIntoView({ block: 'center' }) } // FIXME: without this whole page scrolls to the bottom - el.value?.querySelector('.result')?.scrollIntoView({ block: 'start' }) + resultsEl.value?.firstElementChild?.scrollIntoView({ block: 'start' }) }, { debounce: 200, immediate: true } )