From aca14c14ca86e8d44c406f42a5e008ba2a763e96 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 15 Jan 2019 15:57:09 +0100 Subject: [PATCH] Add some comments --- .../infiniteeditors/linkpicker/linkpicker.controller.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/linkpicker/linkpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/linkpicker/linkpicker.controller.js index 588db6d392..3c7234f019 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/linkpicker/linkpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/linkpicker/linkpicker.controller.js @@ -37,13 +37,17 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController", var oneTimeTreeSync = { executed: false, treeReady: false, - sync: function() { + sync: function () { + // don't run this if: + // - it was already run once + // - the tree isn't ready yet + // - the model path hasn't been loaded yet if (this.executed || !this.treeReady || !($scope.model.target && $scope.model.target.path)) { return; } this.executed = true; - //now sync the tree to this path + // sync the tree to the model path $scope.dialogTreeApi.syncTree({ path: $scope.model.target.path, tree: "content"