Commit 3fdb8bb
authored
fix(map): disable Save Map while pending and harden mobile save flows
## Summary
Harden the map save flow on three axes:
1. **Disable both Save Map triggers while a save mutation is pending** (sidebar + mobile floating overlay). Prevents the user from queuing duplicate saves or opening a second name dialog while one is in flight.
2. **Disable the settings-sheet Save Map button when no configuration changes are present** (bbox, zoom, or basemap still at defaults). Forces the settings flow to be config-first.
3. **Close the mobile settings sheet before opening the save-name dialog.** Keeps the modal stack tidy so the user is never hidden behind a sheet.
The mobile floating overlay intentionally has *no* `!hasConfigChanges` guard — 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.tsx`
- `disabled={createMap.isPending || !hasConfigChanges}` on the settings-sheet Save Map button
- `disabled={createMap.isPending}` on the mobile floating Save Map button (intentional, see comment)
- `hasConfigChanges` useMemo: compares bbox / zoomRange / selectedStyle against defaults
- `openNameDialog()` now closes the settings sheet before opening the name dialog
- New i18n key `activeMapOnlineBadge` to distinguish online vs. offline active-map copy
- `src/i18n/messages/{en,es,pt}.json`: new `activeMapOnlineBadge` message in all three locales
- Tests: 9 new cases — both triggers disable while pending, both re-enable on settle, mobile default-state asymmetry, draw cancel, DownloadPanel integration, name-required error, no-project empty state, frame confirm happy path, map attribution
## Test coverage
MapScreen.tsx: 72.17% stmts / 68.83% branches → 94.78% stmts / 84.41% branches (all 4 metrics ≥ 80% per AGENTS.md)
Full suite: 2050 passed, 1 skipped (164 files)
## CI
All 15 required checks green. `mergeState: CLEAN`. Codex GPT-5.6-Sol independent readiness assessment: 5/5.
## Preview
https://fix-save-map-disabled.comapeo-cloud-app.pages.dev1 parent b88f915 commit 3fdb8bb
7 files changed
Lines changed: 413 additions & 7 deletions
File tree
- src
- i18n/messages
- screens/MapScreen
- tests/unit
- screens/MapScreen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
403 | 407 | | |
404 | 408 | | |
405 | 409 | | |
406 | | - | |
| 410 | + | |
407 | 411 | | |
408 | 412 | | |
409 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
965 | 968 | | |
966 | 969 | | |
967 | 970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
227 | 239 | | |
228 | 240 | | |
| 241 | + | |
229 | 242 | | |
230 | 243 | | |
231 | 244 | | |
| |||
319 | 332 | | |
320 | 333 | | |
321 | 334 | | |
322 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
323 | 340 | | |
324 | 341 | | |
325 | 342 | | |
| |||
424 | 441 | | |
425 | 442 | | |
426 | 443 | | |
427 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
428 | 452 | | |
429 | 453 | | |
430 | 454 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
392 | 394 | | |
393 | 395 | | |
394 | 396 | | |
| |||
0 commit comments