Skip to content

Commit 1105059

Browse files
SlimaneAmarSlimane AMAR
andauthored
Fix reset as parameters with contingencies (#1071)
Co-authored-by: Slimane AMAR <slimane.amar_externe@rte-france.com>
1 parent f5f2820 commit 1105059

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/parameters/common/contingency-table/contingency-table.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ export function ContingencyTable({
4444

4545
useEffect(() => {
4646
if (showContingencyCount) {
47-
if (!contingencyListsInfos || contingencyListsInfos.length === 0) {
47+
const hasNoContingencies =
48+
!contingencyListsInfos ||
49+
(contingencyListsInfos.length ?? 0) === 0 ||
50+
contingencyListsInfos.every(
51+
(contingencyList) => (contingencyList[CONTINGENCY_LISTS]?.length ?? 0) === 0
52+
);
53+
if (hasNoContingencies) {
4854
setSimulatedContingencyCount(null);
4955
return;
5056
}

src/components/parameters/security-analysis/columns-definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const getSAParametersFormSchema = (name: string | null, limitReductions?:
6565

6666
export const toFormValueSaParameters = (params: SAParameters) => ({
6767
[PARAM_SA_PROVIDER]: params[PARAM_SA_PROVIDER],
68-
...toFormValuesContingencyListsInfos(params?.[CONTINGENCY_LISTS_INFOS]),
68+
...toFormValuesContingencyListsInfos(params?.[CONTINGENCY_LISTS_INFOS] ?? []),
6969
...toFormValuesLimitReductions(params?.limitReductions),
7070
// SA specific form values
7171
[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD]: params[PARAM_SA_FLOW_PROPORTIONAL_THRESHOLD] * 100,

0 commit comments

Comments
 (0)