Skip to content

Commit

Permalink
fix(pro:search): segment states should be reset after blur (#1553)
Browse files Browse the repository at this point in the history
segment states need to be reset after blur when its not confirmed
  • Loading branch information
sallerli1 committed May 17, 2023
1 parent c0d2e9c commit b8cada3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/pro/search/src/composables/useSegmentStates.ts
Expand Up @@ -191,6 +191,10 @@ export function useSegmentStates(
const validateRes = validateSearchState(key)
const searchValue = convertStateToValue(key)

Object.entries(segmentStates.value).forEach(([name, state]) => {
updateSegmentValue(state.value, name, key)
})

if (!validateRes) {
removeSearchState(key)
} else {
Expand All @@ -216,8 +220,7 @@ export function useSegmentStates(
if (!segmentState) {
return
}
const { value, index } = segmentState
updateSegmentValue(value, name, props.searchItem!.key)
const { index } = segmentState

// only confirm searchItem when the last segment is confirmed
// if the last segment is searchItem name, confirm the searchItem only when no searchField is selected
Expand Down

0 comments on commit b8cada3

Please sign in to comment.