-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
bug(upgrade): infinite digests with setTimeout (repro inside) #6385
Comments
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034
This commit effectively reverts 7e0f02f as it was an invalid fix for #6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix #6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes #10660, #12318, #12034 PR Close #13812
This commit effectively reverts 7e0f02f as it was an invalid fix for #6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix #6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes #10660, #12318, #12034 PR Close #13812
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See angular#13812
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See angular#13812
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See angular#13812
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for #6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix #6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See #13812 PR Close #14039
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for #6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix #6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See #13812 PR Close #14039
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034 PR Close angular#13812
@petebacondarwin Shouldn't this bug be reopened after #13812 ? We are experiencing issues resulting in the infamous "$digest already in progress" |
@petebacondarwin Did you have any updates on this problem, or a tentative idea on how to tackle/implement it? |
This fixes angular#6385 by running `$rootScope.$digest` in a child zone. This prevents tasks started in the digest cycle from triggering the digest again, thus preventing the infinite loop.
This fixes angular#6385 by running `$rootScope.$digest` in a child zone. This prevents tasks started in the digest cycle from triggering the digest again, thus preventing the infinite loop.
This fixes angular#6385 by running `$rootScope.$digest` in a child zone. This prevents tasks started in the digest cycle from triggering the digest again, thus preventing the infinite loop.
This fixes angular#6385 by running `$rootScope.$digest` in a child zone. This prevents tasks started in the digest cycle from triggering the digest again, thus preventing the infinite loop.
This fixes angular#6385 by running `$rootScope.$digest` in a child zone. This prevents tasks started in the digest cycle from triggering the digest again, thus preventing the infinite loop.
@petebacondarwin any update? Will this be fixed in the near future? |
+1 Any update on this please? |
Hi, What about the comment here that states that #13812 also reverted the line which replaced This was originally introduced in #9054. |
I'm also blocked by this. Haven't been able to upgrade to new versions since this was reverted. I'm not sure the frequency of this issue is low either. It's hard to track because infinite digests still allow the app run properly but it's just that the performance is very bad. I was only able to realize what was happening via a chrome extension that was showing me angular 1 digest frequency. |
We are generally not keen on changing This unfortunately means that running scope.$watch(
() => {
// Watch function.
// Do NOT use `setTimeout()` here (unless you explicitly run it outside the Angular zone).
},
() => {
// Watch listener function.
// You can use `setTimeout()` here.
}
) The new downgradeModule(), which decouples the change detections of the two frameworks, could possibly help in such situations. (Docs will be added with #18487.) |
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034 PR Close angular#13812
This commit effectively reverts 7e0f02f but for `upgrade/static` as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. See angular#13812 PR Close angular#14039
Have you please got any update on this? The bug really prevents us from upgrading to latest Angular and we're quite stuck with AngularJS 1. |
@andreialecu @trotyl What do you think? Is the issue relevant? It seems to me that the problem is connected with calling setTimeout |
Will not fix: not feasible. |
How should we address upgrading our app from Angular 1 if this is not feasible? We're having a big enterprise project and have chosen AngularJS (1) because it was well supported and promoted by Google. One of the reasons was that we were hoping the project will stay maintanable in time. Instead, Angular 2-6 is a completely new framework, practically incompatible with AngularJS and there is no way to upgrade because of this issue. |
@KirillMetrik, the thing that is not feasible is using All this means is that (if you choose not to use |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit effectively reverts 7e0f02f as it was an invalid fix for angular#6385, that created a more significant bug, which was that changes were not always being detected. Angular 1 digests should be run inside the ngZone to ensure that async changes are detected. We don't know how to fix angular#6385 without breaking change detection at this stage. That issue is triggered by async operations, such as `setTimeout`, being triggered inside scope watcher functions. One could argue that watcher functions should be pure and not do work such as triggering async operations. It is possible that the original use case could be supported by moving the debounce logic into the watch listener function, which is only called if the watched value actually changes. Closes angular#10660, angular#12318, angular#12034 PR Close angular#13812
angular2/upgrade has a bug that occurs when an angular1 watcher calls
setTimeout
, as is the case with many angular1 components.Repro: http://plnkr.co/edit/5iCEQOSOer5c630FStXv?p=preview
This results in infinite angular1 digests because of this line:
https://github.com/angular/angular/blob/master/modules/angular2/src/upgrade/upgrade_adapter.ts#L341
Changing
ngZone.run
tongZone.runOutsideAngular
there seems to fix it or make it more manageable.The text was updated successfully, but these errors were encountered: