Skip to content

Commit

Permalink
chore: minor refactor #2069
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok committed Jul 19, 2023
1 parent 7fdba61 commit 1a4e4ae
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ui/src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,8 @@ export const
selection = React.useMemo(() => new Fluent.Selection({
onSelectionChanged: () => {
const selectedItemKeys = selection.getSelection().map(item => item.key as S)
const areEqual = (arr1: any, arr2: any) => {
if (arr1.length !== arr2.length) return false
return arr1.every((el, idx) => el === arr2[idx])
}
if (!areEqual(wave.args[m.name], selectedItemKeys)) {
const args = wave.args[m.name] as S[]
if (args.length !== selectedItemKeys.length || args.some((item, idx) => item !== selectedItemKeys[idx])) {
wave.args[m.name] = selectedItemKeys
if (m.events?.includes('select')) wave.emit(m.name, 'select', selectedItemKeys)
}
Expand Down

0 comments on commit 1a4e4ae

Please sign in to comment.