Commit 3686f62f authored by Nathan Friend's avatar Nathan Friend

Remove suppress_ajax_navigation_errors feature flag

This commit removes the suppress_ajax_navigation_errors feature flag.
This flag was already enabled by default, so this has no effect on the
product.
parent ad72bab6
...@@ -33,11 +33,9 @@ window.addEventListener('beforeunload', () => { ...@@ -33,11 +33,9 @@ window.addEventListener('beforeunload', () => {
// Ignore AJAX errors caused by requests // Ignore AJAX errors caused by requests
// being cancelled due to browser navigation // being cancelled due to browser navigation
const { gon } = window;
const featureFlagEnabled = gon && gon.features && gon.features.suppressAjaxNavigationErrors;
axios.interceptors.response.use( axios.interceptors.response.use(
response => response, response => response,
err => suppressAjaxErrorsDuringNavigation(err, isUserNavigating, featureFlagEnabled), err => suppressAjaxErrorsDuringNavigation(err, isUserNavigating),
); );
export default axios; export default axios;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* An Axios error interceptor that suppresses AJAX errors caused * An Axios error interceptor that suppresses AJAX errors caused
* by the request being cancelled when the user navigates to a new page * by the request being cancelled when the user navigates to a new page
*/ */
export default (err, isUserNavigating, featureFlagEnabled) => { export default (err, isUserNavigating) => {
if (featureFlagEnabled && isUserNavigating && err.code === 'ECONNABORTED') { if (isUserNavigating && err.code === 'ECONNABORTED') {
// If the user is navigating away from the current page, // If the user is navigating away from the current page,
// prevent .then() and .catch() handlers from being // prevent .then() and .catch() handlers from being
// called by returning a Promise that never resolves // called by returning a Promise that never resolves
......
...@@ -41,7 +41,6 @@ module Gitlab ...@@ -41,7 +41,6 @@ module Gitlab
# Initialize gon.features with any flags that should be # Initialize gon.features with any flags that should be
# made globally available to the frontend # made globally available to the frontend
push_frontend_feature_flag(:suppress_ajax_navigation_errors, default_enabled: true)
push_frontend_feature_flag(:snippets_vue, default_enabled: false) push_frontend_feature_flag(:snippets_vue, default_enabled: false)
end end
......
...@@ -6,24 +6,20 @@ describe('suppressAjaxErrorsDuringNavigation', () => { ...@@ -6,24 +6,20 @@ describe('suppressAjaxErrorsDuringNavigation', () => {
const NAV_ERR_CODE = 'ECONNABORTED'; const NAV_ERR_CODE = 'ECONNABORTED';
it.each` it.each`
isFeatureFlagEnabled | isUserNavigating | code isUserNavigating | code
${false} | ${false} | ${OTHER_ERR_CODE} ${false} | ${OTHER_ERR_CODE}
${false} | ${false} | ${NAV_ERR_CODE} ${false} | ${NAV_ERR_CODE}
${false} | ${true} | ${OTHER_ERR_CODE} ${true} | ${OTHER_ERR_CODE}
${false} | ${true} | ${NAV_ERR_CODE} `('should return a rejected Promise', ({ isUserNavigating, code }) => {
${true} | ${false} | ${OTHER_ERR_CODE}
${true} | ${false} | ${NAV_ERR_CODE}
${true} | ${true} | ${OTHER_ERR_CODE}
`('should return a rejected Promise', ({ isFeatureFlagEnabled, isUserNavigating, code }) => {
const err = { code }; const err = { code };
const actual = suppressAjaxErrorsDuringNavigation(err, isUserNavigating, isFeatureFlagEnabled); const actual = suppressAjaxErrorsDuringNavigation(err, isUserNavigating);
return expect(actual).rejects.toBe(err); return expect(actual).rejects.toBe(err);
}); });
it('should return a Promise that never resolves', () => { it('should return a Promise that never resolves', () => {
const err = { code: NAV_ERR_CODE }; const err = { code: NAV_ERR_CODE };
const actual = suppressAjaxErrorsDuringNavigation(err, true, true); const actual = suppressAjaxErrorsDuringNavigation(err, true);
const thenCallback = jest.fn(); const thenCallback = jest.fn();
const catchCallback = jest.fn(); const catchCallback = jest.fn();
......
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