Adding Save Edits Button on Mobile#220
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>
Mirror the desktop Save edits control on mobile: while in edit mode the top-right navbar shows a Save edits button that commits any pending pin move and exits edit mode (handleEditModeChange(false)), matching desktop. Cancel still discards a pending drag. Co-authored-by: Cursor <cursoragent@cursor.com>
Review summaryNice cleanup on the mobile Save/Cancel flow, and the 🔴 Blocking: duplicate/ghost polylines on the mapIn
The fallback stays attached to the map, orphaned from the ref, forever. Net effect: every route gets a permanent ghost straight line under/crossing the real route, on basically every load with 1+ routes. Suggested fix — dispose the previous entry before every write in const prev = polylinesByVehicleRef.current[route.vehicleId];
if (prev) prev.setMap(null);
polylinesByVehicleRef.current[route.vehicleId] = roadPoly;🟡 Worth a look
Test coverage
NitThe PR description only documents the mobile navbar change, but the diff also includes a substantial |
Summary
handleEditModeChange(false).Motivation
saving-marker-location.Changes
Frontend (
app/ui)MobileResultsNavbar.tsxisEditModeis true.saveDisabledprop.page.tsxisEditModeandonSaveEdits={() => handleEditModeChange(false)}to the mobile navbar.Backend / 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→ Edit (bottom sheet) → Save edits appears top-right.Risk
handleEditModeChangecommit-on-exit logic fromsaving-marker-location.Rollout and Recovery
app/ui; no migrations or feature flags.saving-marker-location(this branch adds one commit on top).High-Signal PR Checklist