Commit 8ef1c75a by Torkel Ödegaard Committed by GitHub

fix(react2angular): Fixed react to angular wrapper watching function expressions…

fix(react2angular): Fixed react to angular wrapper watching function expressions causing infinte digest loop, fixes #16194 (#16196)
parent 7c81f4df
...@@ -110,20 +110,23 @@ function watchProps(watchDepth, scope, watchExpressions, listener) { ...@@ -110,20 +110,23 @@ function watchProps(watchDepth, scope, watchExpressions, listener) {
const watchGroupExpressions = []; const watchGroupExpressions = [];
watchExpressions.forEach(expr => { for (const expr of watchExpressions) {
const actualExpr = getPropExpression(expr); const actualExpr = getPropExpression(expr);
const exprWatchDepth = getPropWatchDepth(watchDepth, expr); const exprWatchDepth = getPropWatchDepth(watchDepth, expr);
// ignore empty expressions & expressions with functions
if (!actualExpr || actualExpr.match(/\(.*\)/) || exprWatchDepth === 'one-time') {
continue;
}
if (exprWatchDepth === 'collection' && supportsWatchCollection) { if (exprWatchDepth === 'collection' && supportsWatchCollection) {
scope.$watchCollection(actualExpr, listener); scope.$watchCollection(actualExpr, listener);
} else if (exprWatchDepth === 'reference' && supportsWatchGroup) { } else if (exprWatchDepth === 'reference' && supportsWatchGroup) {
watchGroupExpressions.push(actualExpr); watchGroupExpressions.push(actualExpr);
} else if (exprWatchDepth === 'one-time') {
//do nothing because we handle our one time bindings after this
} else { } else {
scope.$watch(actualExpr, listener, exprWatchDepth !== 'reference'); scope.$watch(actualExpr, listener, exprWatchDepth !== 'reference');
} }
}); }
if (watchDepth === 'one-time') { if (watchDepth === 'one-time') {
listener(); listener();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment