Commit a9708de
committed
fix($rootScope): when adding/removing watchers during $digest
Previously, adding a watcher during a `$digest` (i.e. from within a watcher),
would result in the next watcher getting skipped. Similarly, removing a watcher
during a `$digest` could result in the current watcher being run twice (if the
removed watcher had not run yet in the current `$digest`).
This commit fixes both cases by keeping track of the current watcher index
during a digest and properly updating it when adding/removing watchers.
Fixes angular#15422
Closes angular#154241 parent 77ed85b commit a9708de
2 files changed
Lines changed: 84 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
| 421 | + | |
420 | 422 | | |
421 | 423 | | |
422 | 424 | | |
423 | | - | |
| 425 | + | |
| 426 | + | |
424 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
425 | 431 | | |
426 | 432 | | |
427 | 433 | | |
| |||
754 | 760 | | |
755 | 761 | | |
756 | 762 | | |
757 | | - | |
758 | 763 | | |
759 | 764 | | |
760 | 765 | | |
| |||
795 | 800 | | |
796 | 801 | | |
797 | 802 | | |
798 | | - | |
799 | | - | |
| 803 | + | |
| 804 | + | |
800 | 805 | | |
801 | | - | |
| 806 | + | |
802 | 807 | | |
803 | 808 | | |
804 | 809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
501 | 573 | | |
502 | 574 | | |
503 | 575 | | |
| |||
598 | 670 | | |
599 | 671 | | |
600 | 672 | | |
601 | | - | |
| 673 | + | |
602 | 674 | | |
603 | 675 | | |
604 | 676 | | |
| |||
895 | 967 | | |
896 | 968 | | |
897 | 969 | | |
898 | | - | |
899 | | - | |
| 970 | + | |
900 | 971 | | |
901 | 972 | | |
902 | 973 | | |
| |||
0 commit comments