Skip to content

Commit

Permalink
fix(pro:search): empty input segment should be invalid (#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Mar 7, 2023
1 parent 1be87e8 commit 168620e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/pro/search/src/segments/createInputSegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { InputSearchField, Segment } from '../types'

export function createInputSegment(prefixCls: string, searchField: InputSearchField): Segment<string> {
export function createInputSegment(prefixCls: string, searchField: InputSearchField): Segment<string | undefined> {
const {
fieldConfig: { trim },
defaultValue,
Expand All @@ -19,7 +19,7 @@ export function createInputSegment(prefixCls: string, searchField: InputSearchFi
inputClassName: [inputClassName, `${prefixCls}-input-segment-input`],
placeholder: searchField.placeholder,
defaultValue,
parse: input => input,
parse: input => (input ? input : undefined),
format: value => (trim ? value?.trim() : value) ?? '',
}
}

0 comments on commit 168620e

Please sign in to comment.