Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 408f64a

Browse files
committed
perf($rootScope): do not mark the $watchCollection interceptor $stateful
... for literal expressions
1 parent 3650723 commit 408f64a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ng/rootScope.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,10 @@ function $RootScopeProvider() {
581581
* de-registration function is executed, the internal watch operation is terminated.
582582
*/
583583
$watchCollection: function(obj, listener) {
584-
$watchCollectionInterceptor.$stateful = true;
584+
// Mark it as $stateful to avoid any input-watching and always invoke the interceptor
585+
// since the inputs will most likely be non-simple (like collections!).
586+
// ... unless it is a literal and input-watching may be sufficient.
587+
$watchCollectionInterceptor.$stateful = !$parse(obj).literal;
585588

586589
var self = this;
587590
// the current value, updated on each dirty-check run

0 commit comments

Comments
 (0)