From a051a6c7557571c5e708c491b0976c4ca4e3d13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20B=C3=BCnger?= Date: Wed, 31 Mar 2021 22:03:06 +0200 Subject: [PATCH 1/2] SSR: Check for existence of window before calling it --- src/Tree.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tree.tsx b/src/Tree.tsx index 9529601..c115b0f 100644 --- a/src/Tree.tsx +++ b/src/Tree.tsx @@ -286,6 +286,7 @@ const generateNewTree = < let tempRecord: NodeRecord | null = rootRecord; const useIdleCallback = + typeof window !== 'undefined' && 'requestIdleCallback' in window && placeholder !== undefined && // If placeholder is set to null and this is the first build, idle callback From 48d63f609a7345a726f0b624fb2bbae02934df4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20B=C3=BCnger?= Date: Thu, 27 May 2021 21:11:50 +0200 Subject: [PATCH 2/2] Update src/Tree.tsx only do single existence check Co-authored-by: Vlad Rindevich --- src/Tree.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Tree.tsx b/src/Tree.tsx index c115b0f..d24d149 100644 --- a/src/Tree.tsx +++ b/src/Tree.tsx @@ -286,8 +286,7 @@ const generateNewTree = < let tempRecord: NodeRecord | null = rootRecord; const useIdleCallback = - typeof window !== 'undefined' && - 'requestIdleCallback' in window && + typeof requestIdleCallback !== 'undefined' placeholder !== undefined && // If placeholder is set to null and this is the first build, idle callback // won't be used. It is necessary for trees with async data which can be