Conversation
…into commons-ui Signed-off-by: achour94 <berrahmaachour@gmail.com>
…cation-into-commons-ui # Conflicts: # src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughVoltage-level modification flow was refactored to use shared DTOs and form utilities from Changes
Sequence Diagram(s)sequenceDiagram
participant User as "User"
participant Dialog as "VoltageLevelModificationDialog"
participant FormUtil as "commons-ui\nForm Utilities"
participant Service as "Study Service\nmodifyVoltageLevel"
participant Backend as "Backend API"
rect rgba(63, 81, 181, 0.5)
User->>Dialog: open dialog / request voltage-level data
Dialog->>FormUtil: init form (voltageLevelModificationEmptyFormData + flags)
FormUtil-->>Dialog: form instance
end
rect rgba(3, 169, 244, 0.5)
Dialog->>Service: fetch equipment/voltage-level (if needed)
Service-->>Dialog: voltageLevelToModify (VoltageLevelDto)
Dialog->>FormUtil: reset(formFromDto(voltageLevelToModify)), preserve IDs
end
rect rgba(0, 150, 136, 0.5)
User->>Dialog: submit
Dialog->>FormUtil: get current form state
FormUtil-->>Dialog: voltageLevelModificationFormData
Dialog->>Service: modifyVoltageLevel({ studyUuid, nodeUuid, ...dto })
Service->>Backend: POST body = JSON.stringify(dto)
Backend-->>Service: 200 / error
Service-->>Dialog: result
Dialog-->>User: success / error
end
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
license-eye has totally checked 938 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 892 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
There was a problem hiding this comment.
license-eye has totally checked 938 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 892 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx`:
- Around line 145-156: When the fetch fails we clear voltageLevelToModify but
leave the selector hidden because selectedId remains set; update the catch block
to also restore the equipment selector by calling setSelectedId(null) (or
setSelectedId(editData?.equipmentId) if you want to fall back to the previous
selection) after setDataFetchStatus(FetchStatus.FAILED) and reset(...). Modify
the catch branch that calls setVoltageLevelToModify(undefined) to also invoke
setSelectedId(...) so the selector becomes visible and the user can pick another
equipment.
In `@src/services/study/network-modifications.ts`:
- Around line 59-61: The import list containing VoltageLevelCreationInfo and
VscCreationInfos has an extra blank line breaking Prettier rules; edit the named
import block that includes VoltageLevelCreationInfo and VscCreationInfos (the
import statement that exports these types) and remove the stray blank line so
the named imports are contiguous on consecutive lines with no empty line between
them.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7e90b025-5dd8-462f-8775-158629d61686
📒 Files selected for processing (7)
src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsxsrc/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsxsrc/components/dialogs/network-modifications/voltage-level/voltage-level.type.tssrc/services/network-modification-types.tssrc/services/study/network-modifications.tssrc/translations/en.jsonsrc/translations/fr.json
💤 Files with no reviewable changes (5)
- src/services/network-modification-types.ts
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
- src/translations/en.json
- src/translations/fr.json
- src/components/dialogs/network-modifications/voltage-level/voltage-level.type.ts
| .catch(() => { | ||
| setDataFetchStatus(FetchStatus.FAILED); | ||
| reset((formValues) => ({ ...formValues, [FieldConstants.EQUIPMENT_ID]: equipmentId }), { | ||
| keepDirty: true, | ||
| }); | ||
| if (editData?.equipmentId !== equipmentId) { | ||
| setVoltageLevelInfos(null); | ||
| setVoltageLevelToModify(undefined); | ||
| } | ||
| }); | ||
| } else { | ||
| setVoltageLevelInfos(null); | ||
| reset(emptyFormData, { keepDefaultValues: true }); | ||
| setVoltageLevelToModify(undefined); | ||
| reset(voltageLevelModificationEmptyFormData, { keepDefaultValues: true }); |
There was a problem hiding this comment.
Restore the equipment selector after a fetch failure.
If a newly selected or default voltage level fails to load, selectedId stays set while voltageLevelToModify is cleared. Because the selector is only shown when selectedId == null, the dialog gets stuck on an empty form and the user cannot pick another equipment without closing it.
↩️ One simple recovery path
.catch(() => {
setDataFetchStatus(FetchStatus.FAILED);
reset((formValues) => ({ ...formValues, [FieldConstants.EQUIPMENT_ID]: equipmentId }), {
keepDirty: true,
});
if (editData?.equipmentId !== equipmentId) {
setVoltageLevelToModify(undefined);
+ setSelectedId(null);
}
});🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx`
around lines 145 - 156, When the fetch fails we clear voltageLevelToModify but
leave the selector hidden because selectedId remains set; update the catch block
to also restore the equipment selector by calling setSelectedId(null) (or
setSelectedId(editData?.equipmentId) if you want to fall back to the previous
selection) after setDataFetchStatus(FetchStatus.FAILED) and reset(...). Modify
the catch branch that calls setVoltageLevelToModify(undefined) to also invoke
setSelectedId(...) so the selector becomes visible and the user can pick another
equipment.
There was a problem hiding this comment.
license-eye has totally checked 938 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 892 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
|
There is an issue with the substationid field being empty in the form. A solution is being implemented. The other components of the form seemed to be working fine. |
There was a problem hiding this comment.
license-eye has totally checked 938 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 892 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
Signed-off-by: achour94 <berrahmaachour@gmail.com>
There was a problem hiding this comment.
license-eye has totally checked 939 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 893 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
There was a problem hiding this comment.
license-eye has totally checked 939 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 893 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx (1)
153-160:⚠️ Potential issue | 🟠 MajorRestore the selector after a fetch failure.
This branch still clears
voltageLevelToModifywithout clearingselectedId, so the dialog stays on the form path and the user cannot pick another equipment after the error.Suggested recovery fix
if (editData?.equipmentId !== equipmentId) { setVoltageLevelToModify(undefined); + setSelectedId(null); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx` around lines 153 - 160, On fetch failure the catch branch clears voltageLevelToModify but leaves selectedId set, preventing the UI from returning to the selector; update the catch block (the code using setDataFetchStatus, reset and setVoltageLevelToModify) to also clear the selection by calling the selector setter (e.g. setSelectedId(undefined) or equivalent) so both voltageLevelToModify and selectedId are cleared when editData?.equipmentId !== equipmentId, ensuring the dialog returns to the equipment selector after a failed fetch; keep the existing reset(...) and setDataFetchStatus(FetchStatus.FAILED) behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In
`@src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx`:
- Around line 153-160: On fetch failure the catch branch clears
voltageLevelToModify but leaves selectedId set, preventing the UI from returning
to the selector; update the catch block (the code using setDataFetchStatus,
reset and setVoltageLevelToModify) to also clear the selection by calling the
selector setter (e.g. setSelectedId(undefined) or equivalent) so both
voltageLevelToModify and selectedId are cleared when editData?.equipmentId !==
equipmentId, ensuring the dialog returns to the equipment selector after a
failed fetch; keep the existing reset(...) and
setDataFetchStatus(FetchStatus.FAILED) behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 572871b6-532b-481b-8556-2566fd44e085
📒 Files selected for processing (1)
src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-dialog.tsx
There was a problem hiding this comment.
license-eye has totally checked 931 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 885 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
…tion dialog Signed-off-by: achour94 <berrahmaachour@gmail.com>
There was a problem hiding this comment.
license-eye has totally checked 931 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 885 | 1 | 45 | 0 |
Click to see the invalid file list
- src/components/dialogs/network-modifications/voltage-level/modification/voltage-level-modification-form.tsx
…tion dialog Signed-off-by: achour94 <berrahmaachour@gmail.com>
|



PR Summary