From 874efa40ea7e44ddadc7e6437d22b36ceb0a56f9 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 5 Dec 2014 15:22:14 -0800 Subject: [PATCH] [Layout] Avoid infinite digest error Perform initial population of scope in mct-representation at link time, instead of waiting for watches to be fired; this avoids the need for extra digest iterations, which Angular detects as indicators of infinite loops (throwing exceptions accordingly.) Fixed in the context of supporting transition of editable Layouts, because these errors were being thrown upon exiting Edit mode. WTD-535. --- platform/representation/src/MCTRepresentation.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index aa6f6bd6ee..a0250bc43b 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -131,6 +131,12 @@ define( // same domain object; these changes should be tracked in the // model's "modified" field, by the mutation capability. $scope.$watch("domainObject.getModel().modified", refresh); + + // Do one initial refresh, so that we don't need another + // digest iteration just to populate the scope. Failure to + // do this can result in unstable digest cycles, which + // Angular will detect, and throw an Error about. + refresh(); } return {