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: rename and refacto StdcmInputVia #10218

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

clarani
Copy link
Contributor

@clarani clarani commented Jan 2, 2025

No description provided.

@clarani clarani requested a review from a team as a code owner January 2, 2025 09:50
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Jan 2, 2025
@clarani clarani requested review from SarahBellaha, SharglutDev and Yohh and removed request for SarahBellaha January 2, 2025 09:50
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2025

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

Codecov Report

Attention: Patch coverage is 98.75000% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.47%. Comparing base (1e79fc2) to head (0d5b248).
Report is 65 commits behind head on dev.

Files with missing lines Patch % Lines
front/src/utils/strings.ts 0.00% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10218      +/-   ##
==========================================
+ Coverage   81.43%   81.47%   +0.03%     
==========================================
  Files        1057     1058       +1     
  Lines      104212   104272      +60     
  Branches      720      722       +2     
==========================================
+ Hits        84870    84958      +88     
+ Misses      19300    19273      -27     
+ Partials       42       41       -1     
Flag Coverage Δ
editoast 73.68% <ø> (+0.06%) ⬆️
front 89.21% <98.75%> (+0.03%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 87.05% <ø> (+0.04%) ⬆️

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.

- use useDebounce hook instead of custom debounce function
- add a useEffect to update the store when the input is changed
- move the callback function inside the component stopDurationInput

Signed-off-by: Clara Ni <[email protected]>
@clarani clarani force-pushed the cni/refacto-stdcm-input-via branch from d400c63 to 5112724 Compare January 2, 2025 10:31
@clarani clarani self-assigned this Jan 2, 2025
@clarani clarani requested a review from Math-R January 6, 2025 10:01
Comment on lines 56 to 58
if (pathStep.stopType === StdcmStopTypes.PASSAGE_TIME) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to don't let the component decide to render or not but keep it in the parent to prevent unnecessary mounting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done !

Comment on lines 66 to 70
onChange={(e) => {
// TODO: Find a better way to prevent user from entering decimal values
const value = e.target.value.replace(/[\D.,]/g, '');
setStopDuration(value);
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be better to don't automatically replace value with a regex and warn the user that the value can't be used.
Because if I put 3.5, it compute 35 and if i don't pay attention, i will launch the simulation using a 35 minutes stop

Copy link
Contributor

@Math-R Math-R Jan 6, 2025

Choose a reason for hiding this comment

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

So you can make a handleChange function, that will turn a flag and display a warning if the value don't respect the expexted value

Copy link
Contributor

Choose a reason for hiding this comment

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

Another solution would be to round up or down the value to keep minutes only, but this need to be discuss

Copy link
Contributor Author

@clarani clarani Jan 7, 2025

Choose a reason for hiding this comment

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

This portion of code is not related to my PR, can we discuss this later ? :/
We won't forget it since there is already a TODO comment above the problematic lines

Choose a reason for hiding this comment

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

Following Mathieu's invitation, here is my user experience comment. This behaviour is problematic as the change is difficult to spot (a little larger letter spacing and a dot) and could affect results.
That said, we haven't witnessed users entering decimal values during our tests.
As there would be no way for us to know if users get this problem or not, I'm inviting POs to prioritize the issue as high, especially since we currently don't have the possibility to cancel computations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value is now rounded. It's a quick fix, this will need to be discussed again with the POs

Copy link
Contributor

@SharglutDev SharglutDev Jan 7, 2025

Choose a reason for hiding this comment

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

especially since we currently don't have the possibility to cancel computations.

We can since a few weeks :)

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.

5 participants