fix(map): disable Save Map while pending and harden mobile save flows#139
Merged
Conversation
Contributor
|
Preview deployment ready: https://fix-save-map-disabled.comapeo-cloud-app.pages.dev Commit: |
luandro
pushed a commit
that referenced
this pull request
Jul 21, 2026
Adds a unit test verifying that both Save Map trigger buttons (desktop sidebar and mobile floating button) enter disabled state while createMap.isPending is true, preventing re-opening the name dialog during an in-flight save mutation. Reported by Greptile on PR #139.
luandro
pushed a commit
that referenced
this pull request
Jul 21, 2026
The handleSaveMap function awaits mutateAsync before closing the dialog, so the buttons stay hidden behind the modal overlay while the mutation is pending. Click Cancel to dismiss first, then verify both trigger buttons are disabled. Amended test from Greptile feedback on PR #139.
luandro
added a commit
that referenced
this pull request
Jul 22, 2026
Resolves baseline CI audit failure that blocked PR #139 and other PRs. - Bumps vitest + @vitest/* from 4.1.8 to 4.1.10 (fixes GHSA-p63j-vcc4-9vmv) - Adds overrides for fast-uri, sharp, axios, joi, js-yaml, shell-quote - Adds ci.yml ignore for stale bun advisory (already fixed in 4.1.10) - No source file changes
added 12 commits
July 22, 2026 11:11
The 'Save Map' button in both the settings sidebar and the mobile overlay was always enabled, but clicking it while createMap.isPending truly does nothing — the previous mutation is still in flight. Disable both instances while createMap.isPending to prevent confusing no-op clicks.
Adds a unit test verifying that both Save Map trigger buttons (desktop sidebar and mobile floating button) enter disabled state while createMap.isPending is true, preventing re-opening the name dialog during an in-flight save mutation. Reported by Greptile on PR #139.
The handleSaveMap function awaits mutateAsync before closing the dialog, so the buttons stay hidden behind the modal overlay while the mutation is pending. Click Cancel to dismiss first, then verify both trigger buttons are disabled. Amended test from Greptile feedback on PR #139.
Dexie.add() returns PromiseExtended<string>, not a standard Promise. The lint-safe cast would require importing Dexie's internal type. Use eslint-disable-next-line with explanation instead.
The settings-sheet Save Map button (mobile 'Map settings' panel) was always enabled, but clicking it with default bbox/zoom/basemap creates a meaningless draft. Now disabled until the user actually changes at least one config option (basemap, bounds, or zoom range). The floating Save Map button on the map (mobile, bottom-right) remains always enabled — its context implies active map work. Adds hasConfigChanges memo comparing bbox, zoomRange, and selectedStyle against DEFAULT_* constants. Tests updated: - New test: disabled with defaults, enabled after basemap change - Existing tests: change basemap first to enable button before clicking
The online active badge (shown when a map is set active but SMP blob
not yet downloaded) was reusing the 'Active offline map' i18n message,
making it appear the map was already available offline when it wasn't.
Added a separate activeMapOnlineBadge message ('Active map (online)')
and updated the online badge to use it. The offline badge retains its
original 'Active offline map' label.
The settings sheet (z-[51]) was covering the name dialog Modal (z-50), making the Save Map button appear broken — tapping it opened a dialog the user could never see or interact with. Added setSettingsOpen(false) in openNameDialog() so the sheet closes before the name dialog opens. Desktop is unaffected because the sidebar is a plain aside, not a z-indexed dialog. Added test verifying single dialog remains after opening name dialog from mobile settings sheet.
- await deferred mutation resolution and verify recovery\n- add online active-map translations for Portuguese and Spanish
- verify online active-map badge copy and map name\n- assert both mobile Save Map triggers disable and recover
- verify both mobile save triggers during pending and recovery\n- document intentional quick-action behavior for default map views
luandro
force-pushed
the
fix/save-map-disabled
branch
from
July 22, 2026 14:26
fb50307 to
b8adce6
Compare
- both triggers disable+re-enable while save pending (already covered, kept) - mobile default-state asymmetry: floating enabled, settings-sheet disabled - draw cancel button exits draw_rectangle mode - DownloadPanel renders for maps with downloadable status - empty-name submission shows nameRequired and keeps dialog open - no-project empty state with link to home - frame confirm happy path with undo banner MapScreen.tsx: 72.17% stmts / 68.83% branches -> 94.78% stmts / 84.41% branches (80% per-file threshold met for all 4 metrics per AGENTS.md) Refs PR #139 readiness gap (Codex GPT-5.6-Sol assessment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The 'Save Map' button in the map settings sidebar and mobile overlay was always enabled, but clicking it while
createMap.isPending(a save operation is already in flight) does nothing — it just opens a dialog that can't be completed. Additionally, the settings-sheet 'Save Map' button allowed saving a map identical to the current/default view, and the mobile settings sheet stayed open behind the save-name dialog, hiding the user from the next action.Fix
Harden the map save flow on three axes:
The mobile floating overlay intentionally has no
!hasConfigChangesguard — it is a quick-action affordance that may save the current/default view at any time. Only the pending-disable applies. This asymmetry is now covered by a regression test so a future change to the floating button would fail the suite.Changes
src/screens/MapScreen/MapScreen.tsxdisabled={createMap.isPending || !hasConfigChanges}on the settings-sheet Save Map button (renderControls)disabled={createMap.isPending}on the mobile floating Save Map button (intentional, see comment)hasConfigChangesuseMemo: compares bbox / zoomRange / selectedStyle against defaultsopenNameDialog()now closes the settings sheet before opening the name dialogactiveMapOnlineBadgeto distinguish online vs. offline active-map copysrc/i18n/messages/{en,es,pt}.json: newactiveMapOnlineBadgemessage in all three localesTesting
Out of scope
disabled={createMap.isPending}on the dialog's own 'Save draft' submit button is unchanged (it usesloading={createMap.isPending})Greptile Summary
This PR hardens the map save flow and updates active-map badge copy. The main changes are:
Save Maptriggers while a save is pending.Save Mapbutton until bbox, zoom, or basemap changes exist.Confidence Score: 5/5
Safe to merge with minimal risk.
The changed behavior is localized to the map save UI and badge copy. The mobile quick-action asymmetry is intentional and covered by tests. No functional or security issues were identified in the changed files.
No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram
Reviews (12): Last reviewed commit: "test: cover mobile save flow gaps and re..." | Re-trigger Greptile