Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

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

Draft
bbecquet wants to merge 19 commits into
Qwant:masterfrom
bbecquet:refacto-direction-store
Draft

Refacto directions (using a store, converting DirectionPanel to functional, etc.)#1227
bbecquet wants to merge 19 commits into
Qwant:masterfrom
bbecquet:refacto-direction-store

Conversation

@bbecquet

@bbecquet bbecquet commented Oct 28, 2021

Copy link
Copy Markdown
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant