Skip to content

Commit

Permalink
Ensure entry.contentBoxSize exists before accessing properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlrice committed Nov 12, 2024
1 parent cefdfa2 commit 4c04593
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/nightingale-new-core/src/mixins/withResizable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ export default withResizable;
const SingletonResizeObserver = new ResizeObserver((entries) => {
window.requestAnimationFrame(() => {
for (const entry of entries) {
const width = entry.contentBoxSize[0].inlineSize;
const height = entry.contentBoxSize[0].blockSize;
resize(
entry.target as NightingaleBaseElement & WithResizableInterface,
width,
height
);
const width = entry.contentBoxSize?.[0].inlineSize;
const height = entry.contentBoxSize?.[0].blockSize;
if (typeof width !== "undefined" && typeof height !== "undefined") {
resize(
entry.target as NightingaleBaseElement & WithResizableInterface,
width,
height
);
}
}
});
});
Expand Down

0 comments on commit 4c04593

Please sign in to comment.