Commit a53f5131 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'ntepluhina-remove-graphql-error-suppression' into 'master'

Removed a GraphQL error suppression on assignees dropdown

See merge request gitlab-org/gitlab!64489
parents 67327b6b 25860ae8
......@@ -96,9 +96,6 @@ export default {
},
},
searchUsers: {
// TODO Remove error policy
// https://gitlab.com/gitlab-org/gitlab/-/issues/329750
errorPolicy: 'all',
query: searchUsers,
variables() {
return {
......@@ -111,28 +108,10 @@ export default {
return !this.isEditing;
},
update(data) {
// TODO Remove null filter (BE fix required)
// https://gitlab.com/gitlab-org/gitlab/-/issues/329750
return data.workspace?.users?.nodes.filter((x) => x?.user).map(({ user }) => user) || [];
},
debounce: ASSIGNEES_DEBOUNCE_DELAY,
error({ graphQLErrors }) {
// TODO This error suppression is temporary (BE fix required)
// https://gitlab.com/gitlab-org/gitlab/-/issues/329750
const isNullError = ({ message }) => {
return message === 'Cannot return null for non-nullable field GroupMember.user';
};
if (graphQLErrors?.length > 0 && graphQLErrors.every(isNullError)) {
// only null-related errors exist, suppress them.
// eslint-disable-next-line no-console
console.error(
"Suppressing the error 'Cannot return null for non-nullable field GroupMember.user'. Please see https://gitlab.com/gitlab-org/gitlab/-/issues/329750",
);
this.isSearching = false;
return;
}
error() {
this.$emit('error');
this.isSearching = false;
},
......
......@@ -275,48 +275,4 @@ describe('User select dropdown', () => {
expect(findEmptySearchResults().exists()).toBe(true);
});
});
// TODO Remove this test after the following issue is resolved in the backend
// https://gitlab.com/gitlab-org/gitlab/-/issues/329750
describe('temporary error suppression', () => {
beforeEach(() => {
jest.spyOn(console, 'error').mockImplementation();
});
const nullError = { message: 'Cannot return null for non-nullable field GroupMember.user' };
it.each`
mockErrors
${[nullError]}
${[nullError, nullError]}
`('does not emit errors', async ({ mockErrors }) => {
createComponent({
searchQueryHandler: jest.fn().mockResolvedValue({
errors: mockErrors,
}),
});
await waitForSearch();
expect(wrapper.emitted()).toEqual({});
// eslint-disable-next-line no-console
expect(console.error).toHaveBeenCalled();
});
it.each`
mockErrors
${[{ message: 'serious error' }]}
${[nullError, { message: 'serious error' }]}
`('emits error when non-null related errors are included', async ({ mockErrors }) => {
createComponent({
searchQueryHandler: jest.fn().mockResolvedValue({
errors: mockErrors,
}),
});
await waitForSearch();
expect(wrapper.emitted('error')).toEqual([[]]);
// eslint-disable-next-line no-console
expect(console.error).not.toHaveBeenCalled();
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment