From 24c6bce02d4d1283efd48e2f61f44a74c03c2121 Mon Sep 17 00:00:00 2001 From: Anwarul Islam Date: Fri, 9 Jun 2023 10:10:09 +0600 Subject: [PATCH] fix: failed to execute 'observe' on 'IntersectionObserver' (#3122) --- .../hoppscotch-ui/src/components/smart/Windows.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-ui/src/components/smart/Windows.vue b/packages/hoppscotch-ui/src/components/smart/Windows.vue index a67f16fda..e4f8378c7 100644 --- a/packages/hoppscotch-ui/src/components/smart/Windows.vue +++ b/packages/hoppscotch-ui/src/components/smart/Windows.vue @@ -115,7 +115,9 @@ }" :style="[ `--thumb-width: ${scrollThumb.width}px`, - `width: calc(100% - ${hasActions ? mdAndLarger ? '19rem' : '7rem' : '3rem'})`, + `width: calc(100% - ${ + hasActions ? (mdAndLarger ? '19rem' : '7rem') : '3rem' + })`, ]" id="myRange" /> @@ -144,7 +146,11 @@ import { nextTick, useSlots, } from "vue" -import { breakpointsTailwind, useBreakpoints, useElementSize } from "@vueuse/core" +import { + breakpointsTailwind, + useBreakpoints, + useElementSize, +} from "@vueuse/core" import type { Slot } from "vue" import draggable from "vuedraggable-es" import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index" @@ -350,8 +356,8 @@ watch( rootMargin: "0px", threshold: 1.0, }) - observer.observe(element!) + if (element) observer.observe(element) element?.scrollIntoView({ behavior: "smooth", inline: "center" }) }) },