Displaying Return To Start Path on Route Map#219
Conversation
Use callback-based directions requests with status checks, extract road paths from overview or leg steps, fetch routes sequentially to avoid rate limits, stop overwriting cached road paths with straight lines, and document Directions API requirement in .env.example. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…smatch Restore straight-line polyline fallback on directions cache miss after pin commit, recreate polylines when the directions effect clears refs first, dedupe step-path vertices in extractRoadPath, and defer missing-data errors to a client-only useEffect to prevent SSR hydration mismatch. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the client-only error useEffect with useSyncExternalStore so validation runs after hydration without triggering react-hooks/set-state-in-effect. Co-authored-by: Cursor <cursoragent@cursor.com>
Save edits now persists a dragged marker before leaving edit mode instead of discarding pendingPinMove. Cancel still drops the pending move unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Append the starting point (depot, or first stop when no depot) to the end of each route path so the polyline shows the drive home, even though the optimizer output omits the return leg. Applies to road-following and straight-line fallback paths, and includes the return leg in distance. Co-authored-by: Cursor <cursoragent@cursor.com>
ReviewNice fix for the underlying problem (routes visually ending mid-trip instead of showing the drive home) — the 🔴 Blocking: duplicate/orphaned polylines on load
The placeholder is still attached to the map and is now unreachable from any tracked state, so it's never cleaned up — not even by the next effect-1 cleanup pass, which only iterates whatever's currently in the ref. This isn't a rare interleaving; it reproduces on essentially every initial load of the results page with routes on it (mount → effect 1 clears+starts → effect 2 creates placeholders → each resolves and overwrites without disposing). Expect visible overlapping straight-line + road-line duplicates per route, plus a It's also more likely to trigger now that Suggested fix: before overwriting 🟡 Smaller things
Nit: |
Summary
depot → stops → depot; without a depot, the first stop acts as home.Motivation
Changes
Frontend (
app/ui)Map.tsx—buildRoutePathBackend / mobile app / infra
Validation
Frontend
npm --prefix app/ui run lintnpm --prefix app/ui run format:checknpm --prefix app/ui run typechecknpm --prefix app/ui run testnpm --prefix app/ui run buildnpm --prefix app/ui run test:e2enpm --prefix app/mobile run lintnpm --prefix app/mobile run typecheckBackend
cmake --preset dev.github/scripts/check-backend-static.sh build/devcmake --build --preset dev --parallelctest --preset dev --output-on-failure --no-tests=error -LE 'e2e|docker'docker compose -f deploy/compose/docker-compose.arm64.yml --env-file deploy/env/http-server.arm64.env configManual checks
/results: each route polyline returns to the depot/start along roads.Risk
Rollout and Recovery
app/ui; no migrations or feature flags.saving-marker-location(this branch adds one commit on top).High-Signal PR Checklist