From e89472a2a3328019026e11380559f6bd77bea841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 24 Oct 2024 14:55:13 +0200 Subject: [PATCH] Use forEach instead of map --- src/layertree/TreeManager.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layertree/TreeManager.js b/src/layertree/TreeManager.js index 47560221056f..3a9de1bcba9d 100644 --- a/src/layertree/TreeManager.js +++ b/src/layertree/TreeManager.js @@ -668,7 +668,7 @@ LayertreeTreeManager.prototype.refreshFirstLevelGroups_ = function (themes) { const firstLevelGroupsFullState = {}; // Save state of each child - this.rootCtrl.children.map((treeCtrl) => { + this.rootCtrl.children.forEach((treeCtrl) => { const name = treeCtrl.node.name; firstLevelGroupsFullState[name] = this.getFirstLevelGroupFullState_(treeCtrl); }); @@ -677,7 +677,7 @@ LayertreeTreeManager.prototype.refreshFirstLevelGroups_ = function (themes) { /** @type {import('gmf/themes').GmfGroup[]} */ const nodesToRestore = []; // Iterate on the root to keep the same order in the tree as before. - this.root.children.map((node) => { + this.root.children.forEach((node) => { const name = node.name; // Find the right firstlevelgroup in the new theme. @@ -693,7 +693,7 @@ LayertreeTreeManager.prototype.refreshFirstLevelGroups_ = function (themes) { // Wait that Angular has created the layetree, then restore state and update permalink. this.$timeout_(() => { // Restore state of each child - this.rootCtrl.children.map((treeCtrl) => { + this.rootCtrl.children.forEach((treeCtrl) => { const name = treeCtrl.node.name; this.setFirstLevelGroupFullState_(treeCtrl, firstLevelGroupsFullState[name]); }); @@ -717,7 +717,7 @@ LayertreeTreeManager.prototype.getFirstLevelGroupFullState_ = function (treeCtrl */ const children = {}; // Get the state of the treeCtrl children recursively. - treeCtrl.children.map((child) => { + treeCtrl.children.forEach((child) => { children[child.node.name] = this.getFirstLevelGroupFullState_(child); }); let isChecked, isExpanded, isLegendExpanded; @@ -786,7 +786,7 @@ LayertreeTreeManager.prototype.setFirstLevelGroupFullState_ = function (treeCtrl } // Set the state of the treeCtrl children recursively. - treeCtrl.children.map((child) => { + treeCtrl.children.forEach((child) => { this.setFirstLevelGroupFullState_(child, fullState.children[child.node.name]); }); };