Commit 0ba77670 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '342745-remove-feature-flag' into 'master'

Remove Apollo error suppression feature flag

See merge request gitlab-org/gitlab!74291
parents c35f040a 65dd9c13
......@@ -9,10 +9,6 @@ import { isNavigatingAway } from '~/lib/utils/is_navigating_away';
* @returns {ApolloLink|null}
*/
export const getSuppressNetworkErrorsDuringNavigationLink = () => {
if (!gon.features?.suppressApolloErrorsDuringNavigation) {
return null;
}
return onError(({ networkError }) => {
if (networkError && isNavigatingAway()) {
// Return an observable that will never notify any subscribers with any
......
---
name: suppress_apollo_errors_during_navigation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72031
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/342745
milestone: '14.4'
type: development
group: group::foundations
default_enabled: false
......@@ -56,7 +56,6 @@ module Gitlab
push_frontend_feature_flag(:security_auto_fix, default_enabled: false)
push_frontend_feature_flag(:improved_emoji_picker, default_enabled: :yaml)
push_frontend_feature_flag(:new_header_search, default_enabled: :yaml)
push_frontend_feature_flag(:suppress_apollo_errors_during_navigation, current_user, default_enabled: :yaml)
push_frontend_feature_flag(:configure_iac_scanning_via_mr, current_user, default_enabled: :yaml)
push_frontend_feature_flag(:bootstrap_confirmation_modals, default_enabled: :yaml)
end
......
......@@ -47,107 +47,95 @@ describe('getSuppressNetworkErrorsDuringNavigationLink', () => {
subscription = link.request(mockOperation).subscribe(observer);
};
describe('when disabled', () => {
it('returns null', () => {
expect(getSuppressNetworkErrorsDuringNavigationLink()).toBe(null);
});
it('returns an ApolloLink', () => {
expect(getSuppressNetworkErrorsDuringNavigationLink()).toEqual(expect.any(ApolloLink));
});
describe('when enabled', () => {
beforeEach(() => {
window.gon = { features: { suppressApolloErrorsDuringNavigation: true } };
});
it('returns an ApolloLink', () => {
expect(getSuppressNetworkErrorsDuringNavigationLink()).toEqual(expect.any(ApolloLink));
});
describe('suppression case', () => {
describe('when navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(true);
});
describe('given a network error', () => {
it('does not forward the error', async () => {
const spy = jest.fn();
describe('suppression case', () => {
describe('when navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(true);
});
createSubscription(makeMockNetworkErrorLink(), {
next: spy,
error: spy,
complete: spy,
});
describe('given a network error', () => {
it('does not forward the error', async () => {
const spy = jest.fn();
// It's hard to test for something _not_ happening. The best we can
// do is wait a bit to make sure nothing happens.
await waitForPromises();
expect(spy).not.toHaveBeenCalled();
createSubscription(makeMockNetworkErrorLink(), {
next: spy,
error: spy,
complete: spy,
});
// It's hard to test for something _not_ happening. The best we can
// do is wait a bit to make sure nothing happens.
await waitForPromises();
expect(spy).not.toHaveBeenCalled();
});
});
});
});
describe('non-suppression cases', () => {
describe('when not navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(false);
});
describe('non-suppression cases', () => {
describe('when not navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(false);
});
it('forwards successful requests', (done) => {
createSubscription(makeMockSuccessLink(), {
next({ data }) {
expect(data).toEqual({ foo: { id: 1 } });
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
it('forwards successful requests', (done) => {
createSubscription(makeMockSuccessLink(), {
next({ data }) {
expect(data).toEqual({ foo: { id: 1 } });
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
});
it('forwards GraphQL errors', (done) => {
createSubscription(makeMockGraphQLErrorLink(), {
next({ errors }) {
expect(errors).toEqual([{ message: 'foo' }]);
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
it('forwards GraphQL errors', (done) => {
createSubscription(makeMockGraphQLErrorLink(), {
next({ errors }) {
expect(errors).toEqual([{ message: 'foo' }]);
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
});
it('forwards network errors', (done) => {
createSubscription(makeMockNetworkErrorLink(), {
next: () => done.fail('Should not happen'),
error: (error) => {
expect(error.message).toBe('NetworkError');
done();
},
complete: () => done.fail('Should not happen'),
});
it('forwards network errors', (done) => {
createSubscription(makeMockNetworkErrorLink(), {
next: () => done.fail('Should not happen'),
error: (error) => {
expect(error.message).toBe('NetworkError');
done();
},
complete: () => done.fail('Should not happen'),
});
});
});
describe('when navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(true);
});
describe('when navigating away', () => {
beforeEach(() => {
isNavigatingAway.mockReturnValue(true);
});
it('forwards successful requests', (done) => {
createSubscription(makeMockSuccessLink(), {
next({ data }) {
expect(data).toEqual({ foo: { id: 1 } });
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
it('forwards successful requests', (done) => {
createSubscription(makeMockSuccessLink(), {
next({ data }) {
expect(data).toEqual({ foo: { id: 1 } });
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
});
it('forwards GraphQL errors', (done) => {
createSubscription(makeMockGraphQLErrorLink(), {
next({ errors }) {
expect(errors).toEqual([{ message: 'foo' }]);
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
it('forwards GraphQL errors', (done) => {
createSubscription(makeMockGraphQLErrorLink(), {
next({ errors }) {
expect(errors).toEqual([{ message: 'foo' }]);
},
error: () => done.fail('Should not happen'),
complete: () => done(),
});
});
});
......
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