Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(web): keep whitespace-only option values in select-with-search (#21706)

chanxe1339d7390ad
diff --git a/web/src/components/originui/select-with-search.tsx b/web/src/components/originui/select-with-search.tsx
index afa2ad889f..6a5497d38e 100644
--- a/web/src/components/originui/select-with-search.tsx
+++ b/web/src/components/originui/select-with-search.tsx
@@ -368,7 +368,11 @@ export const SelectWithSearch = forwardRef<
? [option.label]
: []
}
- onSelect={handleSelect}
+ // cmdk trims the item value and hands the trimmed
+ // string to onSelect, which turns whitespace-only
+ // values (Tab, Space, line break) into ''. Select the
+ // option's own value instead.
+ onSelect={() => handleSelect(option.value)}
data-testid={
optionTestIdPrefix && option.value
? `${optionTestIdPrefix}${option.value}`
@@ -411,7 +415,9 @@ export const SelectWithSearch = forwardRef<
group.keywords ??
(typeof group.label === 'string' ? [group.label] : [])
}
- onSelect={handleSelect}
+ onSelect={(selected) =>
+ handleSelect(group.value ?? selected)
+ }
data-testid={
optionTestIdPrefix && group.value
? `${optionTestIdPrefix}${group.value}`
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 79b41db58d..eec6330b92 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -2800,7 +2800,7 @@ Best for: Documents with flowing, contextually connected content — such as boo
comma: 'Comma',
semicolon: 'Semicolon',
period: 'Period',
- lineBreak: 'Line break',
+ linebreak: 'Line break',
tab: 'Tab',
space: 'Space',
delimiters: 'Delimiters',