Skip to content

Commit

Permalink
[@mantine/hooks] use-viewport-size: Add missing size calculation to u…
Browse files Browse the repository at this point in the history
…seEffect (#2085)
  • Loading branch information
rtivital committed Aug 12, 2022
1 parent 6fd76c2 commit f1cbf66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mantine-hooks/src/use-viewport-size/use-viewport-size.ts
@@ -1,4 +1,4 @@
import { useCallback, useState } from 'react';
import { useCallback, useState, useEffect } from 'react';
import { useWindowEvent } from '../use-window-event/use-window-event';

const eventListerOptions = {
Expand All @@ -17,6 +17,7 @@ export function useViewportSize() {

useWindowEvent('resize', setSize, eventListerOptions);
useWindowEvent('orientationchange', setSize, eventListerOptions);
useEffect(setSize, []);

return windowSize;
}

0 comments on commit f1cbf66

Please sign in to comment.