From 6a4b5c5cdc808c2947e4fe04c5a7e1c3ce7821d0 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Sun, 9 Oct 2022 20:39:48 +0530 Subject: [PATCH] fix: move viewport early return above --- packages/web/src/javascripts/App.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web/src/javascripts/App.tsx b/packages/web/src/javascripts/App.tsx index 85fba3420..512686c96 100644 --- a/packages/web/src/javascripts/App.tsx +++ b/packages/web/src/javascripts/App.tsx @@ -47,12 +47,12 @@ let initialCorrectViewportHeight: number | null = null export const setViewportHeightWithFallback = (isOrientationChange = false) => { const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight - if (!newValue) { - document.documentElement.style.setProperty('--viewport-height', '100vh') + if (initialCorrectViewportHeight && newValue < initialCorrectViewportHeight && !isOrientationChange) { return } - if (initialCorrectViewportHeight && newValue < initialCorrectViewportHeight && !isOrientationChange) { + if (!newValue) { + document.documentElement.style.setProperty('--viewport-height', '100vh') return }