From 42d58e8a87f2231a76d235af9ccb9ef9155ebfe2 Mon Sep 17 00:00:00 2001 From: Evgeny Alaev Date: Tue, 9 Jul 2024 15:14:31 +0300 Subject: [PATCH] fix: handle nullable entries --- src/plugins/highcharts/renderer/components/useElementSize.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/highcharts/renderer/components/useElementSize.ts b/src/plugins/highcharts/renderer/components/useElementSize.ts index 0689d56f..21b323a7 100644 --- a/src/plugins/highcharts/renderer/components/useElementSize.ts +++ b/src/plugins/highcharts/renderer/components/useElementSize.ts @@ -34,7 +34,8 @@ export function useElementSize( } const entry = entries[0]; - if (entry.borderBoxSize) { + + if (entry && entry.borderBoxSize) { const borderBoxSize = entry.borderBoxSize[0] ? entry.borderBoxSize[0] : (entry.borderBoxSize as unknown as ResizeObserverSize); @@ -45,7 +46,7 @@ export function useElementSize( width: round(borderBoxSize.inlineSize, ROUND_PRESICION), height: round(borderBoxSize.blockSize, ROUND_PRESICION), }); - } else { + } else if (entry) { const target = entry.target as HTMLElement; setSize({ width: round(target.offsetWidth, ROUND_PRESICION),