Skip to content

Commit

Permalink
fix(pro:search): onChange triggered timing (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 authored Sep 1, 2022
1 parent aba2e4f commit 32cd2bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ export function useTransferData<T extends TransferData = TransferData>(
const targetKeySet = computed(() => new Set(targetKeys.value))

const handleChange = (keys: VKey[]) => {
callEmit(props.onChange, keys, targetKeys.value)
const oldKeys = targetKeys.value
setTargetKeys(keys)
callEmit(props.onChange, keys, oldKeys)
}

const separatedData = computed(() =>
Expand Down
3 changes: 2 additions & 1 deletion packages/pro/search/src/composables/useSearchStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ export function useSearchStates(
})
.filter(Boolean) as SearchValue[]

callEmit(props.onChange, newSearchValues, toRaw(searchValues.value))
const oldeSearchValue = toRaw(searchValues.value)
setSearchValues(newSearchValues)
callEmit(props.onChange, newSearchValues, oldeSearchValue)
}

const updateSegmentValue = (value: unknown, name: string, key: VKey) => {
Expand Down

0 comments on commit 32cd2bd

Please sign in to comment.