forked from angular-ui/ui-router
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($state): reloadOnSearch should not affect non-search param changes.
The handling of `reloadOnSearch: false` caused ui-router to avoid reloading the state in more cases than it should. The designed and documented behavior of this flag is to avoid state reload when the URL search string changes. It was also avoiding state reload when the URL path (or any non-search parameters to the state) changed, and even when state reload was explicitly requested. This change - flips the name of shouldTriggerReload (and the accompanying guard boolean, skipTriggerReloadCheck) to match the direction of the logic: shouldSkipReload and allowSkipReloadCheck - teaches shouldSkipReload to look at the types of the differing parameters, and only skip the reload if the only parameters that differ were search parameters - pulls the test for options.reload to the front of the complex boolean expression. (I think calling $state.reload() explicitly should reload a state even if it has reloadOnSearch:false. But I don't understand exactly why the test for this was where it was, and maybe there's a good reason I'm missing. Also, if the behavior I favor is deemed correct, we could also achieve that by setting allowSkipReloadCheck=false for all truthy values of options.reload, namely, if options.reload===true, and then shouldSkipReload wouldn't even need to look at options. I left a comment about this in the source too and would appreciate feedback.) Fixes angular-ui#1079. Helps with one of the cases broken in angular-ui#582.
- Loading branch information
Matt Ginzton
committed
May 18, 2015
1 parent
22a2b10
commit 49ec726
Showing
2 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
that would be fine by me