From 94bd77121cb0b5bca0a72f0e527d2d488a23890d Mon Sep 17 00:00:00 2001 From: Leo Danielsson Date: Tue, 8 Oct 2019 16:36:58 +0200 Subject: [PATCH] Use the same condition for checking if SSR in useSelector.js as in connectAdvanced.js --- src/hooks/useSelector.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useSelector.js b/src/hooks/useSelector.js index 2b88b16d1..4cc15432b 100644 --- a/src/hooks/useSelector.js +++ b/src/hooks/useSelector.js @@ -20,7 +20,11 @@ import { ReactReduxContext } from '../components/Context' // is created synchronously, otherwise a store update may occur before the // subscription is created and an inconsistent state may be observed const useIsomorphicLayoutEffect = - typeof window !== 'undefined' ? useLayoutEffect : useEffect + typeof window !== 'undefined' && + typeof window.document !== 'undefined' && + typeof window.document.createElement !== 'undefined' + ? useLayoutEffect + : useEffect const refEquality = (a, b) => a === b