Skip to content

Commit 69d62e4

Browse files
LeoDanielssontimdorr
authored andcommitted
Use the same condition for checking if SSR in useSelector.js as in connectAdvanced.js (#1419)
1 parent 31c998a commit 69d62e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hooks/useSelector.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import { ReactReduxContext } from '../components/Context'
2020
// is created synchronously, otherwise a store update may occur before the
2121
// subscription is created and an inconsistent state may be observed
2222
const useIsomorphicLayoutEffect =
23-
typeof window !== 'undefined' ? useLayoutEffect : useEffect
23+
typeof window !== 'undefined' &&
24+
typeof window.document !== 'undefined' &&
25+
typeof window.document.createElement !== 'undefined'
26+
? useLayoutEffect
27+
: useEffect
2428

2529
const refEquality = (a, b) => a === b
2630

0 commit comments

Comments
 (0)