Files
baya-monorepo/mvp/blocker-phases/03-address-edit-bug.md
T
2026-08-02 20:37:14 +03:30

20 lines
1.3 KiB
Markdown

# Phase 03 — Address edit wipes recipient name/phone
**Blocker:** blockers.md § "Data safety."
**Depends on:** nothing. Small and contained.
---
**Root cause.** `AddressForm.tsx` (shared by add and edit) has **no** `recipientName`/`recipientPhone` fields
at all (`:36-42`, `:91-102`). `clientApi.ts:21-34` (`toBody`) sends `null` for both on every create/update
because the form never collects them. The server does a full overwrite, not a merge:
`UpdateAddressCommand.Handler.cs:53-59` unconditionally sets both fields from the request, and the command's
DTO declares them non-nullable `string` — no "field omitted" signal is even possible today. These fields are
consumed downstream (`bookings/request/page.tsx:269-270` snapshots them into a booking request), so a wipe
silently degrades the nurse's day-of-visit contact info for future bookings from that address.
**Fix:** add `recipientName`/`recipientPhone` fields to `AddressForm.tsx` (both add and edit gain them for
free, since it's one shared form) and thread through `AddressFormValues`/`submit()`/`CreateAddressInput`. This
is the root fix. A server-side partial-update stopgap is possible but only prevents further data loss — it
can't let a user actually set these fields, since the form still wouldn't collect them.