-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reload option in transitionTo reloads all states in a hierarchy. Unable to reload just the current nested state. #1612
Comments
What if reload to a string name of the state at which you want to reload?
Alternatively, is this really an issue about transitioning? Or do you just want to reload a state you're already sitting in? In which case, should we be looking at a reload() method directly and it's behavior (which of course could possibly be a reflection of the two truthy versions above so as to allow code reuse). |
@ProLoser, It's not directly related to transitioning, it'a about reloading the controller/resolves for a state with the goal of refreshing data in the current state. However it would be solved if we could reload selected states or a partial hierarchy of states, which would in turn reload the controllers/resolves. |
Just wanted to share my work-around for reloading partial states. First of all don't use the params: {
uniqueRequestCacheBuster: null
} Then if you ever need to reload the current state without parents using the same parameters, you can do it with var params = angular.copy($stateParams);
params.uniqueRequestCacheBuster = Math.random();
$state.transitionTo($state.current, params); The cache buster parameter will not show up in the URL. UI-Router natively handles reloading only partial hierarchies of states when url parameters are changed. if you use the reload option, it will reload all parents as well. This works thanks to @christopherthielen work on params. |
I would still prefer to see reload take a string value. |
That is a better option longer term. |
Seem reasonable |
I have a similar problem with the reload. I use resolves to update data in my state's controller.(when it's an active state) |
The ability to set the descendant depth of the reload is an excellent idea. |
We implemented this feature for a private project. |
I think this makes sense and is a good idea. I'd like to omit the second reloadState parameter, and overload the existing reload parameter.
Squash your commits and set your commit message to match the contributor guidelines. If @nateabele concurs, I think we'll merge this in. |
Created a new PR according to your comments: #1809 |
Fixed in #1809. |
In this implementation the launchpad will be called each time when we call reloadState. This is not exactly how the launchpad working in cell based implementation, but ability to set the descendant depth of the reload would be very useful for the lunchpad functionality and for mnApp in general. Next release of ui-router has all chance to contain what we need. angular-ui/ui-router#1612. Change-Id: If25a8f98dfe5aaea1be7eaff5b398802fb6d122c Reviewed-on: http://review.couchbase.org/46940 Reviewed-by: Pavel Blagodov <[email protected]> Tested-by: Pavel Blagodov <[email protected]>
+1 Was looking this since long back. Thank you. |
Can { reload: ['foo.bar','foo.bar.car.jar'] } |
@DumboJet that doesn't make any sense since reloading a parent state reloads the descendents |
When using the
reload
option instate.transitionTo
on a nested state, all of its parents are also reloaded. You should be able to reload only the current state.My use case is a nested state with params. In some cases I have the same state and params and I simply wish to reload it (to refresh data from the server), however using the
reload
option also reloads it's parents, which resets templates and directives in parent states.One workaround I found is to have some kind of random param in the nested state which is changed every time you wish to reload/refresh the current state. UI-Router seems to handle the case fine when a state has unique params every time, it just cannot reload a state with the exact same params since it believes there is no work to do.
Here is what happens:
reload
option, refreshes the nested state correctly but also reloads all parentsI can setup a plunk, I just wanted to see if this is worthwhile first.
The text was updated successfully, but these errors were encountered: