Skip to content

Commit

Permalink
Prevent form data loss from refetching and add guard statement for ph…
Browse files Browse the repository at this point in the history
…ysician
  • Loading branch information
samau3 committed Sep 10, 2024
1 parent 003fa38 commit 90444b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/pages/patients/PatientRegistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default function PatientRegistration() {
throw new Error('Failed to fetch patient.');
}
},
// disable retry and refetch on window focus to prevent data loss
// from triggering form.initialize()
retry: false,
refetchOnWindowFocus: false
});

const form = useForm({
Expand Down Expand Up @@ -130,7 +134,7 @@ export default function PatientRegistration() {

setInitialPhysicianData({
id: physician ? physician.id : '',
name: `${physician.firstName} ${physician.lastName}`,
name: physician ? `${physician.firstName} ${physician.lastName}`: '',
});

const patientData = {
Expand Down

0 comments on commit 90444b8

Please sign in to comment.