Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use forEach instead of map #9512

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/layertree/TreeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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.
Expand All @@ -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]);
});
Expand All @@ -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;
Expand Down Expand Up @@ -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]);
});
};
Expand Down
Loading