mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-05-25 13:55:05 +02:00
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
|
||
|---|---|---|
| .. | ||
| chat | ||
| file-uploader | ||
| inputs | ||
| layout | ||
| maps | ||
| markdoc | ||
| systeminfo | ||
| ActiveDownloads.tsx | ||
| ActiveEmbedJobs.tsx | ||
| ActiveModelDownloads.tsx | ||
| Alert.tsx | ||
| BouncingDots.tsx | ||
| BouncingLogo.tsx | ||
| BuilderTagSelector.tsx | ||
| CategoryCard.tsx | ||
| CuratedCollectionCard.tsx | ||
| DebugInfoModal.tsx | ||
| DownloadURLModal.tsx | ||
| DynamicIcon.tsx | ||
| Footer.tsx | ||
| HorizontalBarChart.tsx | ||
| InfoTooltip.tsx | ||
| InstallActivityFeed.tsx | ||
| LoadingSpinner.tsx | ||
| MarkdocRenderer.tsx | ||
| ProgressBar.tsx | ||
| StorageProjectionBar.tsx | ||
| StyledButton.tsx | ||
| StyledModal.tsx | ||
| StyledSectionHeader.tsx | ||
| StyledSidebar.tsx | ||
| StyledTable.tsx | ||
| ThemeToggle.tsx | ||
| TierSelectionModal.tsx | ||
| UpdateServiceModal.tsx | ||
| WikipediaSelector.tsx | ||