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

DSR Navigation not correctly stopped #377

Description

@DavideCordella

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions