From 6780b94f01ba788d985eacfb22a347c2e71fc142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Tue, 18 Apr 2023 12:25:44 +0200 Subject: [PATCH] fix: do not report undefined size instead of 0 With the current code, there is no way to differentiate a still unknown size from a 0 size --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 21d1350..78d5969 100644 --- a/src/index.ts +++ b/src/index.ts @@ -118,8 +118,8 @@ function useResizeObserver( const reportedWidth = extractSize(entry, boxProp, "inlineSize"); const reportedHeight = extractSize(entry, boxProp, "blockSize"); - const newWidth = reportedWidth ? round(reportedWidth) : undefined; - const newHeight = reportedHeight + const newWidth = reportedWidth != null ? round(reportedWidth) : undefined; + const newHeight = reportedHeight != null ? round(reportedHeight) : undefined;