Skip to content

Commit

Permalink
fix(components): remove useLayoutEffect to useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Feb 8, 2023
1 parent 495ff1d commit 19ccf1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/table/src/container.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TableColumnType } from 'antd';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { noteOnce } from 'rc-util/lib/warning';
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { createContainer } from 'unstated-next';
import type { DensitySize } from './components/ToolBar/DensityIcon';
import type { ProTableProps } from './index';
Expand Down Expand Up @@ -100,7 +100,7 @@ function useContainer(props: UseContainerProps = {}) {
);

/** 配置或列更改时对columnsMap重新赋值 */
useLayoutEffect(() => {
useEffect(() => {
const { persistenceType, persistenceKey } = props.columnsState || {};

if (persistenceKey && persistenceType && typeof window !== 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions packages/table/src/useFetchData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
usePrevious,
useRefFunction,
} from '@ant-design/pro-utils';
import { useEffect, useLayoutEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import type { PageInfo, RequestData, UseFetchDataAction, UseFetchProps } from './typing';
import { postDataPipeline } from './utils/index';

Expand Down Expand Up @@ -202,7 +202,7 @@ const useFetchData = <T extends RequestData<any>>(
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [polling]);

useLayoutEffect(() => {
useEffect(() => {
umountRef.current = false;

return () => {
Expand Down

0 comments on commit 19ccf1c

Please sign in to comment.