Skip to content

Fix : crash of the SLD/SND when displaying a transfo tooltip#3833

Merged
Mathieu-Deharbe merged 2 commits intomainfrom
tapPosition-index-to-key
Mar 24, 2026
Merged

Fix : crash of the SLD/SND when displaying a transfo tooltip#3833
Mathieu-Deharbe merged 2 commits intomainfrom
tapPosition-index-to-key

Conversation

@Mathieu-Deharbe
Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe commented Mar 24, 2026

tapPosition used to an index and is now a key -> this means that lowTapPosition shouldn't be used anymore to determine the step

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

Tooltip tap-changer characteristics now index steps by tapPosition directly (instead of tapPosition - lowTapPosition) for both ratio (rho) and phase (alpha), retaining rendered tap values and the '-' fallback for missing entries.

Changes

Cohort / File(s) Summary
Tap Changer Tooltip
src/components/tooltips/branch/twt-tap-changer-characteristics.tsx
Replaced offset-based indexing steps[tapPosition - lowTapPosition] with direct steps[tapPosition] for ratio (rho) and phase (alpha) lookups. Kept existing tap rendering and '-' fallback for absent alpha/rho values. Lines changed: +2/-2.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title is related to the changeset, describing a crash fix in SLD/SND transformer tooltips, which aligns with the fix for tap changer characteristics data lookup.
Description check ✅ Passed The description explains the root cause of the changes: tapPosition changed from being an index to a key, making lowTapPosition obsolete, which directly relates to the modifications made.

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

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: 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/tooltips/branch/twt-tap-changer-characteristics.tsx`:
- Line 28: The falsy check on ratioTapChanger.tapPosition treats 0 as absent
causing rho/alpha to show '-' incorrectly; update the ternary expressions that
set rho and alpha (the lines referencing ratioTapChanger.tapPosition and
ratioTapChanger.steps) to test for null/undefined explicitly (e.g., tapPosition
!== null && tapPosition !== undefined) before indexing steps so a valid
tapPosition of 0 returns the real value instead of '-'.
- Around line 27-28: The tap handling is inconsistent: `tap` is set directly
from `ratioTapChanger.tapPosition` while `rho` uses `?? '-'`, causing
`Math.round(r.tap)` (in the code that processes rows) to blow up if `tap` is
null/undefined. Change the assignment to use consistent nullish coalescing
(e.g., `tap: ratioTapChanger.tapPosition ?? '-'`), and make the code that rounds
taps robust by only calling `Math.round` when the value is numeric (e.g.,
`typeof r.tap === 'number' ? Math.round(r.tap) : r.tap`) so
`ratioTapChanger.tapPosition`, the `rho` field, and the `Math.round(r.tap)`
usage are all handled safely and consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3e310b0-0a35-4155-a114-904871651db2

📥 Commits

Reviewing files that changed from the base of the PR and between 87d5c94 and f2b5429.

📒 Files selected for processing (1)
  • src/components/tooltips/branch/twt-tap-changer-characteristics.tsx

Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
@sonarqubecloud
Copy link

@Mathieu-Deharbe Mathieu-Deharbe changed the title tapPosition used to an index and is now a key Fix : crash of the SLD/SND when displaying a transfo tooltip Mar 24, 2026
Copy link
Contributor

@sBouzols sBouzols left a comment

Choose a reason for hiding this comment

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

Code review OK
Test OK
Console warning check OK

@Mathieu-Deharbe Mathieu-Deharbe merged commit f7c3f16 into main Mar 24, 2026
6 checks passed
@Mathieu-Deharbe Mathieu-Deharbe deleted the tapPosition-index-to-key branch March 24, 2026 14:49
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