christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

Sticky State being exited because of paramsEqualForState ignores inherit #308

Open cecilpeng opened 8 years ago

cecilpeng commented 8 years ago

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";
      }
nurfgun commented 8 years ago

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.

ghost commented 8 years ago

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.