This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1944,6 +1944,7 @@ function $ParseProvider() {
1944
1944
return second ( first ( value ) ) ;
1945
1945
}
1946
1946
chainedInterceptor . $stateful = first . $stateful || second . $stateful ;
1947
+ chainedInterceptor . $$pure = first . $$pure && second . $$pure ;
1947
1948
1948
1949
return chainedInterceptor ;
1949
1950
}
@@ -1979,14 +1980,18 @@ function $ParseProvider() {
1979
1980
// If the expression itself has no inputs then use the full expression as an input.
1980
1981
if ( ! interceptorFn . $stateful ) {
1981
1982
useInputs = ! parsedExpression . inputs ;
1982
- fn . inputs = ( parsedExpression . inputs ? parsedExpression . inputs : [ parsedExpression ] ) . map ( function ( e ) {
1983
+ fn . inputs = parsedExpression . inputs ? parsedExpression . inputs : [ parsedExpression ] ;
1984
+
1985
+ if ( ! interceptorFn . $$pure ) {
1986
+ fn . inputs = fn . inputs . map ( function ( e ) {
1983
1987
// Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a
1984
- // potentially non-pure interceptor function.
1988
+ // non-pure interceptor function.
1985
1989
if ( e . isPure === PURITY_RELATIVE ) {
1986
1990
return function depurifier ( s ) { return e ( s ) ; } ;
1987
1991
}
1988
1992
return e ;
1989
1993
} ) ;
1994
+ }
1990
1995
}
1991
1996
1992
1997
return addWatchDelegate ( fn ) ;
Original file line number Diff line number Diff line change @@ -581,7 +581,11 @@ function $RootScopeProvider() {
581
581
* de-registration function is executed, the internal watch operation is terminated.
582
582
*/
583
583
$watchCollection : function ( obj , listener ) {
584
- $watchCollectionInterceptor . $stateful = true ;
584
+ // Mark the interceptor as
585
+ // ... $$pure when literal since the instance will change when any input changes
586
+ $watchCollectionInterceptor . $$pure = $parse ( obj ) . literal ;
587
+ // ... $stateful when non-literal since we must read the state of the collection
588
+ $watchCollectionInterceptor . $stateful = ! $watchCollectionInterceptor . $$pure ;
585
589
586
590
var self = this ;
587
591
// the current value, updated on each dirty-check run
You can’t perform that action at this time.
0 commit comments