Skip to content
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: add memoization to use scenario data and sub hooks #9833

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Synar
Copy link
Contributor

@Synar Synar commented Nov 22, 2024

Some of the results returned by use scenario data are used as dependencies of other hooks, but they are not memoized, causing code to possibly rerun too often.

Also turns a non async useeffect into a usememo. However, this change sometimes create an error in [formatElectrificationRanges <- preparePathPropertiesData <- (usememo in useSpeedSpaceChart)] where associatedProfile is undefined, for some reason I don't understand. I wrapped the function in a try right now, but I believe this should be fixed before considering merging. I also kept the dependency array as is for now, but I'm not of a fan of lying in the dependencies arrays.

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
…echart

Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Nov 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 89 lines in your changes missing coverage. Please review.

Project coverage is 37.77%. Comparing base (b4dd722) to head (1cdf3b1).

Files with missing lines Patch % Lines
...t/components/SpeedSpaceChart/useSpeedSpaceChart.ts 0.00% 40 Missing and 1 partial ⚠️
...ations/operationalStudies/hooks/useScenarioData.ts 0.00% 36 Missing ⚠️
...s/operationalStudies/hooks/useSimulationResults.ts 0.00% 11 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9833      +/-   ##
==========================================
- Coverage   37.79%   37.77%   -0.03%     
==========================================
  Files         994      994              
  Lines       91185    91213      +28     
  Branches     1174     1174              
==========================================
- Hits        34464    34453      -11     
- Misses      56267    56306      +39     
  Partials      454      454              
Flag Coverage Δ
editoast 72.97% <ø> (-0.04%) ⬇️
front 20.07% <0.00%> (-0.02%) ⬇️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 86.74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants