Skip to content
代码片段 群组 项目
未验证 提交 c183bcfd 编辑于 作者: Alexander Turinske's avatar Alexander Turinske
浏览文件

Filter out null groups

- ensure that if a group is null, it is filtered out
  instead of causing a frontend issue

Changelog: changed

EE: true
上级 d0d4fe04
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
......@@ -38,9 +38,9 @@ export default {
const { __typename, avatarUrl, id, fullName, fullPath } = data.group;
const rootGroupMatches = fullName.includes(this.search);
const descendantGroups = (data?.group?.descendantGroups?.nodes || []).map(
createGroupObject,
);
const descendantGroups = (data?.group?.descendantGroups?.nodes || [])
.filter((group) => group)
.map(createGroupObject);
if (!rootGroupMatches) return descendantGroups;
......@@ -48,7 +48,7 @@ export default {
return uniqBy([...this.groups, rootGroup, ...descendantGroups], 'id');
}
const groups = (data?.groups?.nodes || []).map(createGroupObject);
const groups = (data?.groups?.nodes || []).filter((group) => group).map(createGroupObject);
return uniqBy([...this.groups, ...groups], 'id');
},
debounce: DEFAULT_DEBOUNCE_AND_THROTTLE_MS,
......
......@@ -45,6 +45,7 @@ const DESCENDANT_GROUP_RESPONSE = {
{
...group2,
},
null,
],
__typename: 'GroupConnection',
},
......@@ -63,6 +64,7 @@ const NAMESPACE_GROUP_RESPONSE = {
{
...group2,
},
null,
],
__typename: 'GroupConnection',
},
......@@ -187,7 +189,7 @@ describe('GroupSelect component', () => {
});
});
it('contains the root group and descendent group', async () => {
it('contains the root group and descendent group and filtes out null values', async () => {
createComponent({ provide: { globalGroupApproversEnabled: false } });
await waitForApolloAndVue();
await waitForPromises();
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册