mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-12 02:38:15 +00:00
#533: Remove redundant Call History top header (duplicate TopBar) #531: Block logout during active call (confirm dialog + UCID check) #529: Block outbound calls when agent is on Break/Training #527: Remove updatePatient during appointment creation (was mutating shared Patient entity, affecting all past appointments) #547: SLA rules seeded via API (config issue, not code) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -283,23 +283,13 @@ export const AppointmentForm = ({
|
||||
const trimmedName = patientName.trim();
|
||||
const nameChanged = isNameEditable && trimmedName.length > 0 && trimmedName !== initialLeadName;
|
||||
|
||||
// Update patient name ONLY if the agent explicitly renamed.
|
||||
// This guard is the fix for the long-standing bug where the
|
||||
// form silently overwrote existing patients' names with
|
||||
// whatever happened to be in the input.
|
||||
if (nameChanged && patientId) {
|
||||
await apiClient.graphql(
|
||||
`mutation UpdatePatient($id: UUID!, $data: PatientUpdateInput!) {
|
||||
updatePatient(id: $id, data: $data) { id }
|
||||
}`,
|
||||
{
|
||||
id: patientId,
|
||||
data: {
|
||||
fullName: { firstName: trimmedName.split(' ')[0], lastName: trimmedName.split(' ').slice(1).join(' ') || '' },
|
||||
},
|
||||
},
|
||||
).catch((err: unknown) => console.warn('Failed to update patient name:', err));
|
||||
}
|
||||
// DO NOT update the shared Patient entity when name changes
|
||||
// during appointment creation. The Patient record is shared
|
||||
// across all appointments — modifying it here would
|
||||
// retroactively change the name on all past appointments.
|
||||
// The patient name for THIS appointment is stored on the
|
||||
// Appointment entity itself (via doctorName/department).
|
||||
// Bug #527: removed updatePatient() call.
|
||||
|
||||
// Update lead status/lastContacted on every appointment book
|
||||
// (those are genuinely about this appointment), but only
|
||||
|
||||
Reference in New Issue
Block a user