ui-router-extras icon indicating copy to clipboard operation
ui-router-extras copied to clipboard

Sticky State being exited because of paramsEqualForState ignores inherit

Open cecilpeng opened this issue 8 years ago • 2 comments

I simplify the plunker of #265 blow. http://plnkr.co/edit/tQlbI7cD39B5EjWhs9u9?p=preview

Problem: I have 2 screens, one summary and one detail. (in the plunk these are really dumb to illustrate the problem). On the summary screen - change the age, then click "Go" to take you to the detail, on the detail click "Back" to go back to the summary. I would expect the summary screen to show the age which was changed above. However I'm not getting this behaviour.

I think the problem is that paramsEqualForState ignores inherit options. Thus, it makes the summary screen reload, not reactivate.

function getEnterTransition(state, stateParams, reloadStateTree, ancestorReloaded) {
        if (ancestorReloaded) return "reload";
        var inactiveState = inactiveStates[state.self.name];
        if (!inactiveState) return "enter";
        if (state.self === reloadStateTree) return "reload";
        var paramsMatch = paramsEqualForState(state.ownParams, stateParams, inactiveState.locals.globals.$stateParams);
        return paramsMatch ? "reactivate" : "reload";
      }

cecilpeng avatar Mar 19 '16 17:03 cecilpeng

I'm experiencing the same issue. Funny thing is I don't have that most of the time. Thinking of storing all the variables attached to the sticky scope into sessionStorage or something like that before it goes inactive. Hope it gets fixed soon.

nurfgun avatar May 03 '16 03:05 nurfgun

Experiencing the same issue.

I modified in line 103 in ct-ui-router-extras.sticky.js return paramsMatch ? "reactivate" : "reload"; to return "reactivate"

and works as expected. No issues as yet.

ghost avatar Aug 31 '16 05:08 ghost