From b84936a47981712bcef7a4402d93dec0f21eb6d0 Mon Sep 17 00:00:00 2001 From: EkkoLee <40066683+EkkoLee98@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:34:41 +0800 Subject: [PATCH] fix: resolve osInstance is null in `haveScrollbar()` (#1306) Co-authored-by: EkkoLee98 --- src/contentScripts/views/App.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 29743f4c..020a0c3b 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -264,9 +264,12 @@ function openIframeDrawer(url: string) { async function haveScrollbar() { await nextTick() const osInstance = scrollbarRef.value?.osInstance() - const { viewport } = osInstance.elements() - const { scrollHeight } = viewport // get scroll offset - return scrollHeight > window.innerHeight + // If the scrollbarRef is not ready, return false + if (osInstance) { + const { viewport } = osInstance.elements() + const { scrollHeight } = viewport // get scroll offset + return scrollHeight > window.innerHeight + } } // In drawer video, watch btn className changed and post message to parent