Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

DSR Navigation not correctly stopped #377

Open
DavideCordella opened this issue Nov 14, 2017 · 0 comments
Open

DSR Navigation not correctly stopped #377

DavideCordella opened this issue Nov 14, 2017 · 0 comments

Comments

@DavideCordella
Copy link

Dear All,
I can see that when we trigger a navigation to a root state A and DSR towards its child status B is enabled, the initial navigation to A is not "fully stopped" but for some reason it continues even if redirection to B has been trigger.

I believe the problem is at the end of this callback:

`$rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
var cfg = getConfig(toState);
if (ignoreDsr || (computeDeepStateStatus(toState) !== REDIRECT) && !cfg['default']) return;
// We're changing directly to one of the redirect (tab) states.
// Get the DSR key for this state by calculating the DSRParams option
var key = getParamsString(toParams, cfg.params);
var redirect = lastSubstate[toState.name][key] || cfg['default'];
if (!redirect) return;

// we have a last substate recorded
var $dsr$ = { redirect: { state: redirect.state, params: redirect.params}, to: { state: toState.name, params: toParams } };
var result = $injector.invoke(cfg.fn, toState, { $dsr$: $dsr$ });
if (!result) return;
if (result.state) redirect = result;
event.preventDefault();
var redirectParams = getMatchParams(toParams, cfg.params);
**setTimeout(function () { $state.go(redirect.state, angular.extend(redirectParams, redirect.params)); }, 100)**

});`

if I set a timeout on calling the redirection, the initial navigation is correctly stopped and the redirection correctly happend after it.

Can anybody advise? Can we push this change?

Thanks everybody

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant