Skip to content

Commit

Permalink
refactor: replace lodash/memoize with nano-memoize (#6524)
Browse files Browse the repository at this point in the history
* refactor: replace lodash/memoize with nano-memoize

* fix: memoize equal

* fix: memoize equal

* refactor: import
  • Loading branch information
guoyunhe authored Feb 6, 2024
1 parent 1308bb8 commit ca09a21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"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",
Expand Down
7 changes: 7 additions & 0 deletions 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

0 comments on commit ca09a21

Please sign in to comment.