Skip to content

Fix reset as parameters with contingencies#1071

Merged
SlimaneAmar merged 5 commits intomainfrom
fix_reset_as_parameters_with_contingencies
Mar 26, 2026
Merged

Fix reset as parameters with contingencies#1071
SlimaneAmar merged 5 commits intomainfrom
fix_reset_as_parameters_with_contingencies

Conversation

@SlimaneAmar
Copy link
Contributor

PR Summary

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73cc3a9c-51b4-424b-bc47-118163ee8f4a

📥 Commits

Reviewing files that changed from the base of the PR and between 8a5c120 and a545987.

📒 Files selected for processing (1)
  • src/components/parameters/common/contingency-table/contingency-table.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/parameters/common/contingency-table/contingency-table.tsx

📝 Walkthrough

Walkthrough

Two tweaks refine contingency-list handling: the contingency-table useEffect now treats lists with only empty CONTINGENCY_LISTS entries as "no contingencies" and avoids fetching counts, setting simulatedContingencyCount to null; the security-analysis transformer now supplies an empty array (not undefined) when contingency infos are missing.

Changes

Cohort / File(s) Summary
Contingency Table Component
src/components/parameters/common/contingency-table/contingency-table.tsx
Adjusted the useEffect guard to compute hasNoContingencies when all entries have empty or missing CONTINGENCY_LISTS; if true, set simulatedContingencyCount to null and skip fetchContingencyCount.
Security Analysis Form Transformation
src/components/parameters/security-analysis/columns-definitions.ts
Changed toFormValueSaParameters to pass an empty array to toFormValuesContingencyListsInfos when params?.[CONTINGENCY_LISTS_INFOS] is null/undefined, ensuring the spread source is always an array-derived value.
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is empty, providing no details about the changeset, making it impossible to verify relatedness to the actual code modifications. Add a meaningful description explaining what the fix does, why it was needed, and how it addresses the reset behavior with contingencies.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix reset as parameters with contingencies' accurately describes the main change—handling parameter reset behavior when contingencies are present by fixing how empty contingency lists are treated.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…ix_reset_as_parameters_with_contingencies
Copy link

@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.

Actionable comments posted: 1

🤖 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/parameters/common/contingency-table/contingency-table.tsx`:
- Around line 47-50: The current guard in the useEffect reads
contingencyListsInfos[0][CONTINGENCY_LISTS].length without checking that
CONTINGENCY_LISTS exists, which can throw if that key is undefined; update the
condition to safely handle missing or non-array CONTINGENCY_LISTS (e.g., use
optional chaining and Array.isArray checks or a check like
contingencyListsInfos.every(row => Array.isArray(row[CONTINGENCY_LISTS]) &&
row[CONTINGENCY_LISTS].length === 0)) so the guard treats rows with undefined
CONTINGENCY_LISTS as empty and avoids accessing .length on undefined; locate the
check around contingencyListsInfos and CONTINGENCY_LISTS in the
contingency-table component's useEffect and replace it with the safe form.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68bf4ac5-b9dc-425f-a258-7fc4ff443efc

📥 Commits

Reviewing files that changed from the base of the PR and between a1bad06 and beaf9e0.

📒 Files selected for processing (2)
  • src/components/parameters/common/contingency-table/contingency-table.tsx
  • src/components/parameters/security-analysis/columns-definitions.ts

@SlimaneAmar SlimaneAmar requested a review from ayolab March 25, 2026 17:04
…ix_reset_as_parameters_with_contingencies
@sonarqubecloud
Copy link

@SlimaneAmar SlimaneAmar merged commit 1105059 into main Mar 26, 2026
6 checks passed
@SlimaneAmar SlimaneAmar deleted the fix_reset_as_parameters_with_contingencies branch March 26, 2026 14:04
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.

2 participants