From 282a8b0d9f170ea95f5717c8b2ad08ec487d7d8f Mon Sep 17 00:00:00 2001 From: Chris Villa Date: Mon, 1 Apr 2024 18:25:47 +0200 Subject: [PATCH] fix: don't throw undefined error if rapidly zooming browser in some environments Some users were reporting the following error when zooming their browser (not Puck's internal zoom) quickly: > TypeError: Cannot read properties of undefined (reading 'value') at ViewportControls Unable to reproduce, but user confirmed this helped. --- packages/core/components/ViewportControls/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/components/ViewportControls/index.tsx b/packages/core/components/ViewportControls/index.tsx index 5a6a98c3a..702bc34b0 100644 --- a/packages/core/components/ViewportControls/index.tsx +++ b/packages/core/components/ViewportControls/index.tsx @@ -122,7 +122,7 @@ export const ViewportControls = ({
{ e.stopPropagation(); onZoom( @@ -139,7 +139,7 @@ export const ViewportControls = ({ = zoomOptions[zoomOptions.length - 1].value} + disabled={zoom >= zoomOptions[zoomOptions.length - 1]?.value} onClick={(e) => { e.stopPropagation();