Browse Source

refactor: remove shallowequal (#39662)

pull/39844/head
Amumu 2 years ago
committed by GitHub
parent
commit
7329ac7fc7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/config-provider/hooks/useTheme.ts
  2. 7
      components/table/hooks/useFilter/FilterDropdown.tsx
  3. 4
      package.json

4
components/config-provider/hooks/useTheme.ts

@ -1,5 +1,5 @@
import useMemo from 'rc-util/lib/hooks/useMemo';
import shallowEqual from 'shallowequal';
import isEqual from 'rc-util/lib/isEqual';
import type { OverrideToken } from '../../theme/interface';
import type { ThemeConfig } from '../context';
import { defaultConfig } from '../../theme/internal';
@ -47,7 +47,7 @@ export default function useTheme(
prev.some((prevTheme, index) => {
const nextTheme = next[index];
return !shallowEqual(prevTheme, nextTheme);
return !isEqual(prevTheme, nextTheme, true);
}),
);

7
components/table/hooks/useFilter/FilterDropdown.tsx

@ -1,6 +1,6 @@
import FilterFilled from '@ant-design/icons/FilterFilled';
import classNames from 'classnames';
import shallowEqual from 'shallowequal';
import isEqual from 'rc-util/lib/isEqual';
import type { FieldDataNode } from 'rc-tree';
import * as React from 'react';
import type { MenuProps } from '../../../menu';
@ -232,7 +232,7 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
return null;
}
if (shallowEqual(mergedKeys, filterState?.filteredKeys)) {
if (isEqual(mergedKeys, filterState?.filteredKeys, true)) {
return null;
}
@ -444,9 +444,10 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
const getResetDisabled = () => {
if (filterResetToDefaultFilteredValue) {
return shallowEqual(
return isEqual(
(defaultFilteredValue || []).map((key) => String(key)),
selectedKeys,
true,
);
}

4
package.json

@ -150,9 +150,8 @@
"rc-tree-select": "~5.6.0",
"rc-trigger": "^5.2.10",
"rc-upload": "~4.3.0",
"rc-util": "^5.25.2",
"rc-util": "^5.27.0",
"scroll-into-view-if-needed": "^3.0.3",
"shallowequal": "^1.1.0",
"throttle-debounce": "^5.0.0"
},
"devDependencies": {
@ -187,7 +186,6 @@
"@types/react-resizable": "^3.0.0",
"@types/react-sticky": "^6.0.4",
"@types/react-window": "^1.8.2",
"@types/shallowequal": "^1.1.1",
"@types/throttle-debounce": "^5.0.0",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",

Loading…
Cancel
Save