-
Notifications
You must be signed in to change notification settings - Fork 44
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
Cnh/replace simulation conf reducer by slice #5583
Conversation
f412a90
to
8ca2619
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #5583 +/- ##
============================================
- Coverage 27.30% 26.85% -0.46%
Complexity 2136 2136
============================================
Files 952 952
Lines 124900 124095 -805
Branches 2690 2574 -116
============================================
- Hits 34106 33327 -779
- Misses 89189 89279 +90
+ Partials 1605 1489 -116
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1dea74a
to
d1a9dfa
Compare
d1a9dfa
to
0b38d8d
Compare
775bf41
to
3709829
Compare
3709829
to
0648532
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.
Thank you for this amazing work ! Reviewed only the code for now, will test it asap.
Left comments. 90% of them are related with this recent front guideline for type imports.
front/src/modules/trainschedule/components/Timetable/Timetable.tsx
Outdated
Show resolved
Hide resolved
front/src/modules/trainschedule/components/Timetable/Timetable.tsx
Outdated
Show resolved
Hide resolved
front/src/modules/trainschedule/components/Timetable/Timetable.tsx
Outdated
Show resolved
Hide resolved
front/src/modules/trainschedule/components/Timetable/TimetableManageTrainSchedule.tsx
Outdated
Show resolved
Hide resolved
front/src/modules/trainschedule/components/Timetable/TimetableTrainCard.tsx
Outdated
Show resolved
Hide resolved
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.
Tested the app in operational studies, stdcm with modals, store is still updated and persistent, good job !
One more request regarding one of my previous comment : you can remove the updateFeatureInfoClick
action in the map reducer (the one updating an id), its only used at one place in the code and doesn't do anything as there isn't any selector for the related state. (approved by @nicolaswurtz)
494ac32
to
7bee515
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, thank you for the hard work ! I approve for my part but I'll let @clarani check it too in case I missed something
(Good luck for the many many conflicts :) )
.../modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/RenderPopup.tsx
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/operationalStudiesConf/simulationConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
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.
Here are some comments, I'm still reviewing the PR
front/src/reducers/osrdconf/operationalStudiesConf/selectors.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
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.
I've just finished to review the reducers files ! :)
front/src/reducers/osrdconf/operationalStudiesConf/simulationConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
620f926
to
c6025b1
Compare
a7edc71
to
0456f1a
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.
Thanks, here are some global comments:
- check the imports to 'Store' (it is invalid, the import should occur from 'store')
- rename the following types to pascal case and remove the -Type:
- OperationalStudiesConfSliceType (=> OperationalStudiesConfSlice)
- OperationalStudiesConfSliceActionsType
- OperationalStudiesConfSelectorsType
- mapSliceActionsType
- StdcmConfSliceType
- StdcmConfSelectorsType
- editorSliceType
- EditorSliceActionsType (=> EditorSliceAction)
- EditorActionsType (=> EditorAction)
- EditorSelectorsType
- mapViewerSliceType
- MapViewerStateType
- CommonConfReducersType
- InfraStateReducersType (=> InfraStateReducer)
- InfraStateType
- MapViewerSelectorsType
- ... (maybe I forgot some)
- stdcmMode is not used anymore, so you can remove it from the store
front/src/reducers/mapViewer/__tests__/mapViewerReducer.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/operationalStudiesConf/simulationConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/operationalStudiesConf/simulationConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
Outdated
Show resolved
Hide resolved
0456f1a
to
060f913
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.
Some other comments:
- do you think it would be relevant to throw an error if we use useInfraId and infraId is undefined ? This way, we can type it as number
- when using useOsrdActions(), no need to cast now (see 20 occurences approximately). If we use an action specific to a slice, we can directly import it (no need to go through useOsrdActions())
- same thing for useOsrdConfSelectors()
front/src/modules/rollingStock/components/RollingStockSelector/WithRollingStockSelector.tsx
Outdated
Show resolved
Hide resolved
.../modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/RenderPopup.tsx
Outdated
Show resolved
Hide resolved
front/src/modules/trainschedule/components/ManageTrainSchedule/SubmitConfAddTrainSchedule.tsx
Outdated
Show resolved
Hide resolved
.../src/modules/trainschedule/components/ManageTrainSchedule/SubmitConfUpdateTrainSchedules.tsx
Outdated
Show resolved
Hide resolved
.../src/modules/trainschedule/components/ManageTrainSchedule/SubmitConfUpdateTrainSchedules.tsx
Outdated
Show resolved
Hide resolved
41606da
to
9d1478e
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.
Some last comments:
- can you also remove the cast for all the useOsrdConfActions()
front/src/modules/trainschedule/components/ManageTrainSchedule/SubmitConfAddTrainSchedule.tsx
Outdated
Show resolved
Hide resolved
.../modules/trainschedule/components/ManageTrainSchedule/helpers/adjustConfWithTrainToModify.ts
Outdated
Show resolved
Hide resolved
.../modules/trainschedule/components/ManageTrainSchedule/helpers/adjustConfWithTrainToModify.ts
Outdated
Show resolved
Hide resolved
front/src/common/InfraSelector/InfraSelectorModalBodyStandard.tsx
Outdated
Show resolved
Hide resolved
0ffe514
to
20868f5
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.
a0a609d
to
3b02142
Compare
Apparently, the warning is linked to our store becoming increasingly large and, by default, Redux traverses the entire store to check the immutability of each field. Therefore, this check can take some time. If this time exceeds the threshold of 32ms, it triggers the warning.
I opted for the first solution because, as mentioned here, in any case, we use Immer to create our store slices (using createSlice), so we are already ensured of having immutable fields. Therefore, it's not really necessary to check the entire store each time. And as indicated by one of the maintainers here, disabling this option can improve performance. |
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 and it's more fluid now ✅
I tried to check everything, we will have to stay vigilant about it in the coming days
3b02142
to
d7ce070
Compare
…ebase dev - fix osrdConfContext - add mapInfraID in map store - add infraID in props TracksGeographic - add infraID in props common/Map/Layers/Routes - add infraID in props common/Map/Layers/OperationalPoints - add infraID in props common/Map/Layers/Catenaries - add infraID in props BufferStops, Detectors, LineSearchLayer, NeutralSections, Signals, SpeedLimits, Switches, SNCF_PSL - add infraID in props common/Map/Layers/GeoJSONs and add editorInfraID in editor slice - remove eslint warning - create commonState builder - change osrdConfContext to osrdContext - create mapViewer slice - fix eslint error - fix error after rebase - add test mapViewer - fix review's comments front: change type snakeCase to PascalCase and extends InfraStateType to StdcmConf and OperationalStudyConf front: create and use useOsrdConfSelector front: create and use useInfraID front: create and use useOsrdConfActions front: create and use useUpdateInfraID front: move featureInfoClick from infra reducer to osrdConf reducer front: rename/harmonize front: remove stdcmMode from store front: fix front: remove unnecessary condition front: typo front: fix front: remove unised cast front: disable immutableCheck
d7ce070
to
a4085f5
Compare
close #5273
close #5274
Key Updates:
useOsrdConfAction
anduseOsrdConfSelectors
. These enable components that utilize osrdconf to accurately select the appropriate selectors/actions (either stdcmConf or simulationConf).Pre-Merge Tasks:
Currently, components can only utilize osrdConf actions/selectors if they are encapsulated within
OsrdConfContextLayout
. This limitation causes issues in components that require access to osrdConf from the store but are not appropriately wrapped. For instance, the Home component in the application editor, which utilizes getInfraID, is not encapsulated in osrdConf. To address these issues:OsrdConfContextLayout
, using the correct parameters.These adjustments must be applied consistently across all osrdConf fields usages outside the stdcm/* and operational-studies routes.
Additionally, it's worth mentioning the presence of functions like buildCommonConfReducers and buildCommonConfSelectors, which broadly generate reducers and selectors for managing osrdConf parameters. it can help to generate osrdconf parameters needed inside others slices.
Testing