-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
front: fix power restrictions get reset on editing a train #10696
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #10696 +/- ##
==========================================
+ Coverage 81.93% 82.55% +0.62%
==========================================
Files 1084 1083 -1
Lines 107212 107244 +32
Branches 737 728 -9
==========================================
+ Hits 87842 88538 +696
+ Misses 19329 18665 -664
Partials 41 41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
8e397d7
to
6ea39d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not a fan of adding even more workarounds to the current workaround…
Why does the workaround exist in the first place? What are we trying to achieve with isInitialized
?
If we want to launch pathfinding when the hook is mounted and when the infra state is cached and when the rolling stock is loaded, I don't think we need this isInitialized
state?
Or do we want a different behavior?
6ea39d3
to
17bcf9d
Compare
511fc68
to
c667a50
Compare
front/src/applications/operationalStudies/views/ManageTrainSchedule.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Clara Ni <[email protected]>
UseSetupItinerary was used to compute the pathfinding of the train the user wants to edit. However, it was quite redundant with the function launchPathfinding and the cohabitation of the 2 hooks created multiple bugs (power restrictions are reset when editing a train, the invalid path items are not highligthed when editing a train etc). From now on, the pathfinding store will only be populated from the launchPathfinding callback, even when opening the edition panel. Signed-off-by: Clara Ni <[email protected]>
Signed-off-by: Clara Ni <[email protected]>
Signed-off-by: Clara Ni <[email protected]>
c667a50
to
ab5f5cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
closes #10494
After a hard refresh, the pathfinding was relaunched by the useEffect depending on the rolling stock in usePathfinding. Indeed, the trick withisInitialized
did not work because it was set to true before the fetch of the rolling stock. Thus, when the rolling stock was received, the useEffect was triggered and the power restrictions reset.Now, the hook usePathfinding is considered initialized only if there is no rollingStock selected or if the selected rolling stock has been already received.See commits