Skip to content

[Bug] Commute.jsx fails to compile (duplicate saveLocation/deleteSavedLocation) — whole app build is broken #665

Description

@vedant7007

Description

src/components/Commute.jsx fails to compile, and since Commute is a static top-level import in App.jsx (L25, rendered L1310), the entire app build aborts — not just the Commute tab.

Confirmed with esbuild:

ERROR: The symbol "saveLocation" has already been declared
ERROR: The symbol "deleteSavedLocation" has already been declared

A botched merge (last commit f390850 Merge branch 'main' into feature/decompose-commute-component-621) moved the save/delete logic into the useRouteHistory hook but left the old inline copies behind, producing three layered defects in one file:

  1. Duplicate const (build-breaking): saveLocation / deleteSavedLocation are destructured from useRouteHistory() (L45-46) and re-declared as local functions (L86, L101) in the same scope.
  2. Undefined references in those leftovers: they call setSavedLocations(...) (L90, L102) and SAVED_LOCATIONS_KEY (L95, L104), neither of which exists in this file (both live in the hook) — a ReferenceError even if UI Enhancement: Improve Dashboard Layout, Alignment & Responsiveness #1 were fixed.
  3. Missing imports: getAQIBand is used at module-eval time in LEGEND_ITEMS (L22) but never imported → ReferenceError on load; and eventBus.emit("ROUTE_PLANNED", ...) (L68) is used but eventBus is never imported → the route handler throws (caught locally, surfacing the generic "Error calculating route" alert on every successful search and never firing the ROUTE_PLANNED achievement).

Steps to Reproduce

npm run build (or start the dev server) → build aborts with the two "already been declared" errors above.

Fix

  • Delete the two leftover local definitions (L86-107); the destructured hook versions already do this correctly and are the ones passed to CommuteForm.
  • Add the missing imports:
import { getAQIBand } from "../services/airQualityService";
import { eventBus } from "../core/events";

(RouteResults.jsx, RouteMap.jsx, routePlanner.js, useRouteHistory.js are all correct — just unreachable until this compiles.)

Happy to fix if assigned.

Contributing as part of Elite Coders Summer of Code (ECSoC 2026).

Metadata

Metadata

Assignees

Labels

ECSoC26Contributions considered under ECSoC'26

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions