Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

替换 lodash/memoize 为 nano-memoize #6524

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
"classnames": "^2.3.2",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
"nano-memoize": "^3.0.16",
"rc-field-form": "~1.27.4",
"rc-util": "^5.38.1",
"react-fast-compare": "^3.2.2",
"react-is": "^18.2.0",
"runes2": "^1.1.2",
"staged-components": "^1.1.3",
Expand Down
13 changes: 12 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/components/cascader-view/use-cascader-value-extend.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import memoize from 'lodash/memoize'
import isEqual from 'react-fast-compare'
import memoize from 'nano-memoize'
import { CascaderValue, CascaderValueExtend } from './cascader-view'
import type { CascaderOption } from './cascader-view'

Expand Down Expand Up @@ -27,7 +28,9 @@ export function useCascaderValueExtend(

return ret
},
val => JSON.stringify(val)
{
equals: isEqual,
}
)
}, [options])

Expand All @@ -44,7 +47,9 @@ export function useCascaderValueExtend(

return children.length === 0
},
val => JSON.stringify(val)
{
equals: isEqual,
}
)
}, [options])

Expand Down
Loading