Fix : crash of the SLD/SND when displaying a transfo tooltip#3833
Fix : crash of the SLD/SND when displaying a transfo tooltip#3833Mathieu-Deharbe merged 2 commits intomainfrom
Conversation
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
📝 WalkthroughWalkthroughTooltip tap-changer characteristics now index Changes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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.
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
📒 Files selected for processing (1)
src/components/tooltips/branch/twt-tap-changer-characteristics.tsx
src/components/tooltips/branch/twt-tap-changer-characteristics.tsx
Outdated
Show resolved
Hide resolved
src/components/tooltips/branch/twt-tap-changer-characteristics.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
|
sBouzols
left a comment
There was a problem hiding this comment.
Code review OK
Test OK
Console warning check OK



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