Skip to content

Commit d5018f5

Browse files
authored
fix: click the Enter button and an empty tag may appear (#610)
close ant-design/ant-design#29493
1 parent ff723eb commit d5018f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/generate.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,10 @@ export default function generateSelector<
722722
// If menu is open, OptionList will take charge
723723
// If mode isn't tags, press enter is not meaningful when you can't see any option
724724
const onSearchSubmit = (searchText: string) => {
725+
// prevent empty tags from appearing when you click the Enter button
726+
if (!searchText || !searchText.trim()) {
727+
return;
728+
}
725729
const newRawValues = Array.from(
726730
new Set<RawValueType>([...mergedRawValue, searchText]),
727731
);

0 commit comments

Comments
 (0)