Skip to content

Bug: Saving Session Results in an Erorr Regarding No Starting Location #197

Description

@kirillakovalenko

Description

On the Manage (/edit) page, saving a session reuses the same mapper as the optimize
flow. handleExportSession in page.tsx calls
mapEditStateToOptimizeRequest, which validates and geocodes each vehicle's start location
in sessionMapper.ts. Because the
starting location is only collected during optimization (via the "Enter starting location
for all driver routes" overlay), it is empty at save time and the mapper throws an error
about the missing starting location. This blocks a root manager from saving their work,
even though saving should not require a start location at all.

Goal

Allow a root manager to save their session from the Manage page without having entered a
starting location.

Reproduction

Steps

  1. Go to the Manage page (/edit) from a clean state, without running optimization.
  2. Fill out all required information (vehicles and delivery addresses), confirming each row.
  3. Click "Save" in the top corner (Navbar / mobile bottom bar).

Expected: The session is saved (exported) successfully.
Actual: An error appears stating the starting location has not been entered, and the
session is not saved.

Environment: branch main. Affected files: app/ui/src/app/edit/page.tsx,
app/ui/src/app/edit/utils/sessionMapper.ts.

Scope

In scope

  • Decouple the save/export path from the start-location requirement so it succeeds without
    a starting location.
  • Ensure saved sessions handle missing vehicle start locations gracefully (e.g. omit /
    leave them blank) so they can be re-imported and later optimized.

Out of scope

  • The optimize flow's start-location requirement and the depot address overlay (these
    should still require a start location before optimizing).
  • Any redesign of the session save file schema beyond what's needed to allow an absent
    start location.

Acceptance Criteria

  • Saving from the Manage page with all info filled but no starting location succeeds
    and no longer shows the "starting location not entered" error.
  • A session saved without a start location can be re-imported on the Manage page.
  • Optimization still prompts for / requires a starting location (unchanged behavior).
  • Regression test added covering save without a start location.

Assignee

@hir-al-14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions