Skip to content

Commit 50ddcfd

Browse files
chore: fix sonar issues
Signed-off-by: Joris Mancini <[email protected]>
1 parent 05b3b3d commit 50ddcfd

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/components/spreadsheet-view/hooks/use-built-nodes-ids.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { useSelector } from 'react-redux';
99
import type { AppState } from '../../../redux/reducer';
1010
import { useStableComputedSet } from '../../../hooks/use-stable-computed-set';
11-
import type { UUID } from 'crypto';
11+
import type { UUID } from 'node:crypto';
1212
import { validAlias } from './use-node-aliases';
1313
import { NodeType } from '../../graph/tree-node.type';
1414
import { isStatusBuilt } from '../../graph/util/model-functions';
@@ -27,15 +27,15 @@ export function useBuiltNodesIds(nodeAliases: NodeAlias[] | undefined) {
2727
}
2828

2929
const ids = new Set<UUID>();
30-
if (aliasedNodesIds && aliasedNodesIds.length > 0) {
31-
treeNodes?.forEach((treeNode) => {
30+
if (aliasedNodesIds && aliasedNodesIds.length > 0 && treeNodes) {
31+
for (const treeNode of treeNodes) {
3232
if (
3333
aliasedNodesIds.includes(treeNode.id) &&
3434
(treeNode.type === NodeType.ROOT || isStatusBuilt(treeNode.data.globalBuildStatus))
3535
) {
3636
ids.add(treeNode.id);
3737
}
38-
});
38+
}
3939
}
4040
return ids;
4141
}, [nodeAliases, treeNodes]);

src/components/spreadsheet-view/hooks/use-update-equipments-on-notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { useCallback } from 'react';
9-
import type { UUID } from 'crypto';
9+
import type { UUID } from 'node:crypto';
1010
import { DeletedEquipment, isStudyNotification, type NetworkImpactsInfos } from '../../../types/notification-types';
1111
import { isSpreadsheetEquipmentType, SpreadsheetEquipmentType } from '../types/spreadsheet.type';
1212
import {

src/components/spreadsheet-view/spreadsheet/spreadsheet-content/hooks/use-spreadsheet-equipments.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const useSpreadsheetEquipments = (
5050

5151
const nodesIdsToRemove = useStableComputedSet(() => {
5252
const unwantedFetchedNodes = new Set(loadedNodesIdsForType);
53-
builtNodesIds.forEach((nodeId) => unwantedFetchedNodes.delete(nodeId));
53+
for (const nodeId of builtNodesIds) {
54+
unwantedFetchedNodes.delete(nodeId);
55+
}
5456
return unwantedFetchedNodes;
5557
}, [builtNodesIds]);
5658

@@ -59,7 +61,9 @@ export const useSpreadsheetEquipments = (
5961
return builtNodesIds;
6062
}
6163
const nodesIdToFetch = new Set<UUID>(builtNodesIds);
62-
loadedNodesIdsForType.forEach((nodeId) => nodesIdToFetch.delete(nodeId));
64+
for (const nodeId of loadedNodesIdsForType) {
65+
nodesIdToFetch.delete(nodeId);
66+
}
6367
return nodesIdToFetch;
6468
}, [currentNode?.id, loadedNodesIdsForType, nodeAliases, treeNodes]);
6569

0 commit comments

Comments
 (0)