fix: deduplicate in select provider models and target models

This commit is contained in:
jialin
2026-02-08 17:20:05 +08:00
parent ec6f5d1ad3
commit 379eeedde2
6 changed files with 80 additions and 43 deletions
+6 -4
View File
@@ -134,16 +134,18 @@ const TargetsForm = forwardRef((props, ref) => {
const selectedDataList = [...dataList, { value: fallbackValues.value }];
const selectedKeys = selectedDataList
.filter((item) => item.value)
.map((item) => buildKey(item.value));
const selectedKeys = new Set(
selectedDataList
.filter((item) => item.value)
.map((item) => buildKey(item.value))
);
return sourceModels
.map((model) => {
const children = model.children?.filter((child) => {
const key = buildKey([child.data?.parentId, child.value]);
return !selectedKeys.includes(key) || key === currKey;
return !selectedKeys.has(key) || key === currKey;
});
return {