From 63e6620ed74173cb3d9f8dc1d15f908b9a20a885 Mon Sep 17 00:00:00 2001 From: capdiem Date: Wed, 31 Jan 2024 13:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20feat(ScrollToTarget):=20console?= =?UTF-8?q?=20a=20warning=20when=20element=20not=20found?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/scroll-to-target/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Component/BlazorComponent.Web/src/components/scroll-to-target/index.ts b/src/Component/BlazorComponent.Web/src/components/scroll-to-target/index.ts index ad3348a36..79c8d13be 100644 --- a/src/Component/BlazorComponent.Web/src/components/scroll-to-target/index.ts +++ b/src/Component/BlazorComponent.Web/src/components/scroll-to-target/index.ts @@ -15,7 +15,10 @@ class ScrollToTargetJSInterop { observe(id: string) { const el = document.getElementById(id); - if (!el) return; + if (!el) { + console.warn(`[ScrollToTarget] Element with id '${id}' not found`); + return; + } const observer = new IntersectionObserver( async (