Skip to content

Commit

Permalink
fix(pro:search): empty value set by quick select should be removed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Aug 11, 2023
1 parent fa591b5 commit eab7c44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default defineComponent({
convertStateToValue,
createSearchState,
getSearchStatesByFieldKey,
removeSearchState,
updateSegmentValue,
updateSearchValues,
tempSegmentInputRef,
Expand Down Expand Up @@ -65,6 +66,12 @@ export default defineComponent({

const confirmValue = (value: unknown) => {
let searchStateKey = searchState.value?.key

if (!value && searchStateKey) {
removeSearchState(searchStateKey)
return
}

if (!searchState.value) {
searchStateKey = createSearchState(props.searchField.key, {
value,
Expand Down
4 changes: 2 additions & 2 deletions packages/pro/search/src/components/segment/SegmentInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ function useSegmentScroll(
): ComputedRef<SegmentScroll> {
const [segmentScroll, setSegmentScroll] = useState<SegmentScroll>({ left: 0, right: 0 }, true)

let listenerStops: (() => void)[]
let listenerStops: (() => void)[] | undefined
const stopListen = () => {
listenerStops.forEach(stop => stop())
listenerStops?.forEach(stop => stop())
}

const getScrolls = (): SegmentScroll => {
Expand Down

0 comments on commit eab7c44

Please sign in to comment.