fix(app): views not loading when quickly navigating in app (#11278)

pull/11367/head
LP B 9 months ago committed by GitHub
parent 8635bc9b9c
commit 506ee389e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,6 +17,16 @@ export function onStartupAngular($rootScope, $state, cfpLoadingBar, $transitions
HttpRequestHelper.resetAgentHeaders();
});
// EE-6751: screens not loading when switching quickly between side menu options
// Known bug of @uirouter/angularjs
// Fix found at https://github.com/angular-ui/ui-router/issues/3652#issuecomment-574499009
// This hook is cleaning the internal viewConfigs list, removing leftover data unrelated to the current transition
$transitions.onStart({}, (transition) => {
const toList = transition.treeChanges().to.map((t) => t.state.name);
const toConfigs = transition.router.viewService._viewConfigs.filter((vc) => toList.includes(vc.viewDecl.$context.name));
transition.router.viewService._viewConfigs = toConfigs;
});
$(document).ajaxSend((event, jqXhr, jqOpts) => {
const type = jqOpts.type === 'POST' || jqOpts.type === 'PUT' || jqOpts.type === 'PATCH';
const hasNoContentType = jqOpts.contentType !== 'application/json' && jqOpts.headers && !jqOpts.headers['Content-Type'];

Loading…
Cancel
Save