Move Voltage Level Modification functionality and related components into commons-ui#3820
Move Voltage Level Modification functionality and related components into commons-ui#3820
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe changes consolidate voltage level modification form logic by transitioning from local implementations to shared abstractions from the Changes
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ 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
PR Summary