From 69d62e44bf99e9fc103e9e3fee1e8b2b31a24f1f Mon Sep 17 00:00:00 2001 From: LeoDanielsson Date: Tue, 8 Oct 2019 22:06:42 +0200 Subject: [PATCH] Use the same condition for checking if SSR in useSelector.js as in connectAdvanced.js (#1419) --- 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