Skip to content

Commit

Permalink
release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-phan committed Jun 2, 2021
1 parent 1a057aa commit 10408e3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ function useSubscriber<S extends object, P extends [keyof S] | Array<keyof S>>(
}
const [changed, setUpdate] = React.useState({})
const updater = React.useCallback((nextState: S) => {
if (subscriber &&
(!pick ||
!pick.length ||
Object.keys(nextState).find((k) => !!pick.filter(item => item === k).length))
) {
if (subscriber && (!pick?.length || Object.keys(nextState).find((k) => pick.some(item => item === k)))) {
setUpdate({})
}
}, [pick])
Expand Down

0 comments on commit 10408e3

Please sign in to comment.