ui: fix selectedKeys

This commit is contained in:
undefined committed 2025-08-05 03:03:01 +08:00
1 parent 8daabd074b
commit 05c3b8f2bd
1 file changed
+2 -1
@@ -11,11 +11,12 @@ const LanguageSelectAutoComplete = React.forwardRef<any, any>((props, ref) => (
<CustomSelectAutoComplete
ref={ref as any}
{...props}
selectedKeys={typeof props.selectedKeys === 'string' ? props.selectedKeys.split(',') : props.selectedKeys}
data={props.withAuto ? withAuto : data}
renderItem={(item) => (prefixes.has(item._id) ? '' : `${item.name}`)}
onChange={(val) => {
let value = val.split(',');
const active = new Set(value.filter((i) => i.includes('.').map((i) => i.split('.')[0])));
const active = new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
value = value.filter((i) => !prefixes.has(i) || active.has(i));
for (const i of active) if (!value.includes(i)) value.push(i);
props.onChange(value.join(','));