erdapfel icon indicating copy to clipboard operation
erdapfel copied to clipboard

Refacto directions (using a store, converting DirectionPanel to functional, etc.)

Open bbecquet opened this issue 2 years ago • 0 comments

Description

Big overhaul of the directions feature… sadly not 100% finished :/ It's mostly complete but some details may have change and need to be tested thoroughly (ex: behavior of input fields, back/forward actions, mobile details, etc.).

The base idea is to introduce a top-level store (see https://fr.reactjs.org/docs/hooks-reference.html#usereducer and https://dev.to/jackent2b/the-best-couple-usecontext-usereducer-4e65) to manage the complex state transitions of this feature, and build on that to:

  • move the route API calls close to the store, not mixed with UI stuff
  • simplify props passing for sub-components by connecting to the store context and dispatching explicit actions
  • centralize all map effects in a dedicated component (this could have been made before, independantly from the store…)
  • as a result, simplify DirectionPanel by converting it to functional and focus on UI changes

Why

Try to make DirectionPanel more maintainable and the whole direction feature more future-proof.

bbecquet avatar Oct 28 '21 12:10 bbecquet