Skip to content

Commit

Permalink
Use the same condition for checking if SSR in useSelector.js as in co…
Browse files Browse the repository at this point in the history
…nnectAdvanced.js (#1419)
  • Loading branch information
LeoDanielsson authored and timdorr committed Oct 8, 2019
1 parent 31c998a commit 69d62e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/useSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 69d62e4

Please sign in to comment.