Skip to content

Commit

Permalink
fix: handle nullable entries
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 committed Jul 9, 2024
1 parent e16dc08 commit 42d58e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/highcharts/renderer/components/useElementSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export function useElementSize<T extends HTMLElement = HTMLDivElement>(
}

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);
Expand All @@ -45,7 +46,7 @@ export function useElementSize<T extends HTMLElement = HTMLDivElement>(
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),
Expand Down

0 comments on commit 42d58e8

Please sign in to comment.