Skip to content

Commit b452aeb

Browse files
committed
fix: fix server side detection
1 parent 89d51ca commit b452aeb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react/src/utils/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { css } from 'styled-components'
55
const REGEX_HTTPS = /^https/
66
const REGEX_LOCALHOST = /http:\/\/localhost/
77

8+
const isSSR = typeof window === 'undefined'
9+
810
export const isFunction = fn => typeof fn === 'function'
911

1012
export const isObject = obj => typeof obj === 'object'
@@ -81,4 +83,4 @@ export const imageProxy = url => {
8183
)}`
8284
}
8385

84-
export const isLazySupported = !isNil(window) && !isNil(window.IntersectionObserver)
86+
export const isLazySupported = !isSSR && 'IntersectionObserver' in window

0 commit comments

Comments
 (0)