Skip to content

Commit 525a00a

Browse files
fixed the Sonar error
1 parent caa5743 commit 525a00a

File tree

2 files changed

+81
-75
lines changed

2 files changed

+81
-75
lines changed

assets/js/src/core/components/pipeline/item/dynamic-group/dynamic-group-dropdown.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ export const DynamicGroupDropdown = ({ children, dynamicTypeRegistryId }: Dynami
4242
const groupedTree: IGroupedTree = {}
4343

4444
availableDynamicTypes.forEach(dynamicType => {
45-
const groupedIds = !isNull(dynamicType.group)
46-
? Array.isArray(dynamicType.group) ? dynamicType.group : [dynamicType.group]
47-
: []
45+
let groupId: string[] = []
46+
47+
if (!isNull(dynamicType.group)) {
48+
if (Array.isArray(dynamicType.group)) {
49+
groupId = dynamicType.group
50+
} else {
51+
groupId = [dynamicType.group]
52+
}
53+
}
4854

4955
let currentLevel = groupedTree
5056

51-
groupedIds.forEach(groupKey => {
57+
groupId.forEach(groupKey => {
5258
if (isNil(currentLevel[groupKey])) {
5359
currentLevel[groupKey] = {}
5460
}

0 commit comments

Comments
 (0)