From c7c4c0e3af8280d9d9bcda697ee053336987510f Mon Sep 17 00:00:00 2001 From: Arlo Date: Tue, 2 Jan 2024 22:55:16 +0800 Subject: [PATCH] fix: selecting components highlighting bounds incorrectly (#129) --- packages/devtools-kit/src/core/component-inspector/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/devtools-kit/src/core/component-inspector/index.ts b/packages/devtools-kit/src/core/component-inspector/index.ts index 2376a34aa..5da648660 100644 --- a/packages/devtools-kit/src/core/component-inspector/index.ts +++ b/packages/devtools-kit/src/core/component-inspector/index.ts @@ -150,8 +150,8 @@ function inspectFn(e: MouseEvent) { if (instance) { inspectInstance = instance const el = instance.vnode.el as HTMLElement | undefined - if (el && el.nodeType === Node.ELEMENT_NODE) { - const bounds = el.getBoundingClientRect() + if (el) { + const bounds = getComponentBoundingRect(instance) const name = getInstanceName(instance) const container = getCotainerElement() container ? update({ bounds, name }) : create({ bounds, name })