Skip to content

Creation of a composite inside a gridstudy node#3928

Open
Mathieu-Deharbe wants to merge 14 commits into
mainfrom
create-composite-in-gridstudy
Open

Creation of a composite inside a gridstudy node#3928
Mathieu-Deharbe wants to merge 14 commits into
mainfrom
create-composite-in-gridstudy

Conversation

@Mathieu-Deharbe
Copy link
Copy Markdown
Contributor

PR Summary

by merging a list of selected modifications

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@Mathieu-Deharbe Mathieu-Deharbe marked this pull request as draft April 30, 2026 14:58
@coderabbitai

This comment was marked as spam.

coderabbitai[bot]

This comment was marked as spam.

Mathieu-Deharbe and others added 8 commits May 4, 2026 10:57
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@Mathieu-Deharbe Mathieu-Deharbe marked this pull request as ready for review May 18, 2026 15:21
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/graph/menus/network-modifications/network-modification-node-editor.tsx (1)

969-973: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard merge action when no active node is selected.

Line 972 sends currentNode?.id to the merge API, but Line 1302-1307 does not disable the action when currentNode is missing. With stale selection, this can dispatch a merge request with an undefined node id.

🔧 Proposed fix
 const doMergeModificationsIntoComposite = useCallback(() => {
         const selectedModUuids: UUID[] = selectedNetworkModifications.map((item) => item.uuid);
+        if (!studyUuid || !currentNode?.id || selectedModUuids.length === 0) {
+            return;
+        }
         setSaveInProgress(true);
-        mergeModificationsIntoComposite(studyUuid, currentNode?.id, selectedModUuids)
+        mergeModificationsIntoComposite(studyUuid, currentNode.id, selectedModUuids)
             .then((compositeUuid: UUID) => {
                 dispatch(setHighlightModification(compositeUuid));
                 setSelectionResetKey((k) => k + 1);
@@
                             <IconButton
                                 onClick={doMergeModificationsIntoComposite}
                                 size={'small'}
                                 disabled={
                                     selectedNetworkModifications?.length === 0 ||
                                     saveInProgress ||
+                                    !currentNode ||
                                     isRootNode ||
                                     isCompositeNestingLimitReached
                                 }
                             >

Also applies to: 1302-1307

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/components/graph/menus/network-modifications/network-modification-node-editor.tsx`
around lines 969 - 973, The merge action can be invoked with an undefined node
id; update doMergeModificationsIntoComposite (and the other merge handler block
around the later UI action) to guard against missing currentNode: if currentNode
is falsy, do an early return (and do not call setSaveInProgress or
mergeModificationsIntoComposite) and ensure any merge button/trigger is disabled
when currentNode is null so the API never receives currentNode?.id as undefined.
Locate references to doMergeModificationsIntoComposite,
mergeModificationsIntoComposite, selectedNetworkModifications and the other
merge handler and add the null-check + UI disable logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@src/components/graph/menus/network-modifications/network-modification-node-editor.tsx`:
- Around line 969-973: The merge action can be invoked with an undefined node
id; update doMergeModificationsIntoComposite (and the other merge handler block
around the later UI action) to guard against missing currentNode: if currentNode
is falsy, do an early return (and do not call setSaveInProgress or
mergeModificationsIntoComposite) and ensure any merge button/trigger is disabled
when currentNode is null so the API never receives currentNode?.id as undefined.
Locate references to doMergeModificationsIntoComposite,
mergeModificationsIntoComposite, selectedNetworkModifications and the other
merge handler and add the null-check + UI disable logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bf7ce2b1-d310-4762-ae9a-5b0d318e8447

📥 Commits

Reviewing files that changed from the base of the PR and between c0cb09c and 0d73956.

📒 Files selected for processing (1)
  • src/components/graph/menus/network-modifications/network-modification-node-editor.tsx

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant