[4.6] [state] don't make extra $location.replace() calls #9954
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[state] don't make extra $location.replace() calls
Backports PR #8179
Commit 1:
[state] don't make extra $location.replace() calls
Issue:
In order to ensure BWC in the new state-hashing changes, rison encoded query string parameters are automatically converted into hashes and placed back into the URL via
$location.search().replace()
. This ensures that extra history entries don't get created, but this is still happening when hashing is disabled (which is now the default). This causes every state-caused history change to become a replacement, which mutilates the history stack.Fix:
Added a
#isHashingEnabled()
method to the state objects that is called before trying to convert rison encoded query string states and replacing them in the URL.