Skip to content

Commit

Permalink
fix: useLayoutEffect to fix shaking list (#44075)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Aug 7, 2023
1 parent dc06517 commit c583f9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/grid/hooks/useBreakpoint.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef } from 'react';
import { useRef } from 'react';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import useForceUpdate from '../../_util/hooks/useForceUpdate';
import type { ScreenMap } from '../../_util/responsiveObserver';
import useResponsiveObserver from '../../_util/responsiveObserver';
Expand All @@ -8,7 +9,7 @@ function useBreakpoint(refreshOnChange: boolean = true): ScreenMap {
const forceUpdate = useForceUpdate();
const responsiveObserver = useResponsiveObserver();

useEffect(() => {
useLayoutEffect(() => {
const token = responsiveObserver.subscribe((supportScreens) => {
screensRef.current = supportScreens;
if (refreshOnChange) {
Expand Down

0 comments on commit c583f9a

Please sign in to comment.