Fix: Deduplication of wiki entity types (#17965)

This commit is contained in:
balibabu
2026-08-07 11:29:05 +08:00
committed by GitHub
parent 5c8c4346a9
commit b099c88c3f
17 changed files with 223 additions and 35 deletions

View File

@@ -55,7 +55,8 @@ export type SelectWithSearchFlagProps = {
placeholder?: string;
emptyData?: string;
allowCustomValue?: boolean;
onNoMatchEnter?(searchValue: string): void;
// Return false to veto selecting the custom value on Enter
onNoMatchEnter?(searchValue: string): boolean | void;
disableAutoSelectOnEnter?: boolean;
testId?: string;
optionTestIdPrefix?: string;
@@ -221,7 +222,10 @@ export const SelectWithSearch = forwardRef<
setSearchValue('');
setOpen(false);
} else if (!hasMatchingOptions(options, keywords)) {
onNoMatchEnter?.(keywords);
if (onNoMatchEnter?.(keywords) === false) {
// Vetoed: prevent cmdk from selecting the custom value item
e.preventDefault();
}
}
}
},