Skip to content

Commit

Permalink
fix: Filter out the cases where the tagName is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Suntgr committed Mar 7, 2025
1 parent b01fedc commit 00d7cf2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/lb-annotation/src/utils/tool/TagUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ export default class TagUtil {
const [key, value] = cur;
if (value && value.length > 0) {
const valueList = value.split(';');
const nameList = {
keyName: this.getTagKeyName(key, labelInfoSet),
value: valueList.map((v: string) => this.getTagName([key, v], labelInfoSet)),
};
return [...acc, nameList];
const keyName = this.getTagKeyName(key, labelInfoSet) ?? '';
const values = valueList.map((v: string) => this.getTagName([key, v], labelInfoSet));
// 只有当 keyName 存在才添加到结果中
if (keyName.trim() !== '') {
return [...acc, { keyName, value: values }];
}
}
return acc;
}, [])
Expand Down

0 comments on commit 00d7cf2

Please sign in to comment.