This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1944,6 +1944,7 @@ function $ParseProvider() {
19441944 return second ( first ( value ) ) ;
19451945 }
19461946 chainedInterceptor . $stateful = first . $stateful || second . $stateful ;
1947+ chainedInterceptor . $$pure = first . $$pure && second . $$pure ;
19471948
19481949 return chainedInterceptor ;
19491950 }
@@ -1979,14 +1980,18 @@ function $ParseProvider() {
19791980 // If the expression itself has no inputs then use the full expression as an input.
19801981 if ( ! interceptorFn . $stateful ) {
19811982 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 ) {
19831987 // 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.
19851989 if ( e . isPure === PURITY_RELATIVE ) {
19861990 return function depurifier ( s ) { return e ( s ) ; } ;
19871991 }
19881992 return e ;
19891993 } ) ;
1994+ }
19901995 }
19911996
19921997 return addWatchDelegate ( fn ) ;
Original file line number Diff line number Diff line change @@ -581,7 +581,11 @@ 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 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 ;
585589
586590 var self = this ;
587591 // the current value, updated on each dirty-check run
You can’t perform that action at this time.
0 commit comments