You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Infinite digest when replacing $location.hash() #10228
This appears to be a regression in v1.2.27 probably caused by #9470 (@tbosch); v1.2.26 (and earlier, probably at least back to v1.2.24) does not exhibit the problem. The details:
I'm running $locationProvider in html5Mode. In a controller bound with ng-route I have the following code very near the top of the constructor:
if ($location.hash()) {
$rootScope.hash = $location.hash();
$location.replace();
$location.hash('');
return;
}
This is meant to squirrel away the hash and remove it from the URL, causing the controller to be reloaded. What ends up happening in v1.2.27 (in both Chrome 39 and Firefox 33.1.1) is that $browser.url() calls location.replace() but no longer sets reloadLocation because sameBase is true. However, location.href keeps returning the original URL with the hash, causing $locationWatch to spin and keep issuing $browser.url() calls, which are no-ops because lastBrowserUrl is already stripped of the hash. Then everything comes crashing down with an infinite digest error.
It's entirely possible that I'm doing something wrong, in which case I'd really appreciate a hint as to what that might be. Thanks!
@pkaminski@janv there are couple of issues around replacing hash + page reload opened already so it would be good to have a minimal reproduce scenario just to make sure that we've got all of those fixed.
Activity
janv commentedon Nov 26, 2014
I am observing the same problem in 1.3.4
pkozlowski-opensource commentedon Nov 26, 2014
@pkaminski @janv there are couple of issues around replacing hash + page reload opened already so it would be good to have a minimal reproduce scenario just to make sure that we've got all of those fixed.
janv commentedon Nov 26, 2014
Yeah, this seems to be a duplicate of (or closely related to) at least #9635 and #9629
janv commentedon Nov 26, 2014
@pkozlowski-opensource #9635 has a minimal reproduce scenario linked in a plunkr: http://embed.plnkr.co/mwtW1ZxDPDgEdj4PE7wj/preview
That one is Angular 1.3, here it is running 1.2.27: http://embed.plnkr.co/s9DM4wilD8UOefHHrVgd/preview
pkozlowski-opensource commentedon Nov 26, 2014
@janv thnx! Let's keep this one open till the #9635 is fixed but it is good to know that this is a duplicate.
fix($browser): prevent infinite digests when clearing the hash of a url
fix($location): allow hash fragments with hashPrefix in hash-bang loc…
fix($location): allow hash fragments with hashPrefix in hash-bang loc…
petebacondarwin commentedon Dec 3, 2014
Take a look at #10308 - and see if this works for you.
See http://plnkr.co/edit/v2s7sUrLmvJD5HPoGhR8?p=preview, which is using html5Mode
fix($location): allow hash fragments with hashPrefix in hash-bang loc…
fix($location): allow hash fragments with hashPrefix in hash-bang loc…
fix($browser): prevent infinite digests when clearing the hash of a url
fix($browser): prevent infinite digests when clearing the hash of a url