From 4340144e3963496f70a6cc322ab581b649bb9707 Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Wed, 18 Aug 2021 12:58:15 +0300 Subject: [PATCH] fix: add check for SSR environment --- src/Tree.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tree.tsx b/src/Tree.tsx index 57489a8..bdf5b3d 100644 --- a/src/Tree.tsx +++ b/src/Tree.tsx @@ -286,7 +286,7 @@ const generateNewTree = < let tempRecord: NodeRecord | null = rootRecord; const useIdleCallback = - '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