Skip to content

Commit

Permalink
fix: do not emit event when model value/values are changed programati…
Browse files Browse the repository at this point in the history
…cally #2069
  • Loading branch information
marek-mihok authored and mturoci committed Aug 17, 2023
1 parent 15b71f5 commit 039abb2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ui/src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,14 @@ export const
selection = React.useMemo(() => new Fluent.Selection({
onSelectionChanged: () => {
const selectedItemKeys = selection.getSelection().map(item => item.key as S)
wave.args[m.name] = selectedItemKeys
if (m.events?.includes('select')) wave.emit(m.name, 'select', selectedItemKeys)
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)) {
wave.args[m.name] = selectedItemKeys
if (m.events?.includes('select')) wave.emit(m.name, 'select', selectedItemKeys)
}
}
}), [m.name, m.events]),
computeHeight = () => {
Expand Down

0 comments on commit 039abb2

Please sign in to comment.