Skip to content

Commit

Permalink
chore: fix SSR - regression
Browse files Browse the repository at this point in the history
  • Loading branch information
jpudysz committed Nov 6, 2023
1 parent 2743507 commit ee6f483
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hooks/useDimensions.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import { isServer } from '../utils'
export const useDimensions = (): ScreenSize => {
const timerRef = useRef<ReturnType<typeof setTimeout>>()
const [screenSize, setScreenSize] = useState<ScreenSize>({
width: isServer ? 0 : window.innerWidth,
height: isServer ? 0 : window.innerHeight
})
width: isServer
? undefined
: window.innerWidth,
height: isServer
? undefined
: window.innerHeight
} as ScreenSize)

useEffect(() => {
const handleResize = () => {
Expand Down

0 comments on commit ee6f483

Please sign in to comment.