project-nomad/admin/inertia
Chris Sherwood 6f8b2e289a fix(maps): null-island bug + persist view across refresh
Two issues from manual testing of the v1.32 maps bundle on NOMAD3:

1. Refresh of /maps flew to (0, 0) at zoom 12 — Gulf of Guinea / null island.
   Root cause: getMapLocationParams() was reading lat/lng with Number(params.get('lat')),
   but Number(null) === 0 and Number('') === 0. When URL had no params (the typical
   refresh case), both lat and lng silently parsed as 0, validation passed (0 is finite
   and in bounds), and handleMapLoad triggered a flyTo (0, 0, 12).

   Fix: check that lat and lng params are present and non-empty before parsing.

2. User expectation: refresh should preserve current map position and zoom.
   Add localStorage persistence (key 'nomad:map-view'). Save on onMoveEnd; restore
   from initialViewState on mount. Priority order: URL params -> saved view -> default.
   Removed now-redundant flyToLocationParams + handleMapLoad — initialViewState handles
   URL params directly.

3. UX improvement: when /maps loads with ?lat=X&lng=Y, pre-fill the page's
   coordinate search input with "lat,lng" so the user can immediately click the
   marker button to drop a pin at that location without re-typing.

Files:
  admin/inertia/components/maps/MapComponent.tsx
    - getMapLocationParams: hard-fail on null/empty params (export now)
    - getSavedMapView: new helper for localStorage view restore (with bounds check)
    - initialViewState: lazy useState picking URL > saved > default
    - onMoveEnd: persist current view to localStorage
    - removed flyToLocationParams + handleMapLoad
  admin/inertia/pages/maps.tsx
    - import getMapLocationParams
    - lazy useState pre-fills coordinateSearch from URL params
2026-04-30 15:49:31 -07:00
..
app fix(ui): reduce SSE reconnect churn and polling overhead on navigation 2026-03-20 11:46:10 -07:00
components fix(maps): null-island bug + persist view across refresh 2026-04-30 15:49:31 -07:00
context feat: container controls & convienience scripts 2025-08-08 15:07:32 -07:00
css Addressed PR comments about the textarea auto growing, the in flight notes changes asking for confirmation, and updated the hue sort to sort by lightness and then hue so that grayscale values will not collide with red 2026-04-29 02:13:43 -04:00
hooks Initial commit for being able to add notes on map markers and display them 2026-04-26 23:08:55 -04:00
layouts fix: cache docker list requests, aiAssistantName fetching, and ensure inertia used properly 2026-04-03 14:26:50 -07:00
lib Addressed further pr comments about the api, onSave async, and adding a comment about rehypeRaw 2026-04-29 02:57:37 -04:00
pages fix(maps): null-island bug + persist view across refresh 2026-04-30 15:49:31 -07:00
providers feat(UI): add Night Ops dark mode with theme toggle 2026-03-20 11:46:10 -07:00
tsconfig.json fix(Docs): documentation renderer fixes 2025-12-23 16:00:33 -08:00