Skip to content

Commit

Permalink
fix: disable encounter create button during save to prevent multiple …
Browse files Browse the repository at this point in the history
…submissions #9794
  • Loading branch information
bodhish committed Jan 6, 2025
1 parent d05dbd3 commit 7ffc0bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Encounter/CreateEncounterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function CreateEncounterForm({
},
});

const { mutate: createEncounter } = useMutation({
const { mutate: createEncounter, isPending } = useMutation({
mutationFn: mutate(routes.encounter.create),
onSuccess: (data: Encounter) => {
toast.success("Encounter created successfully");
Expand Down Expand Up @@ -318,8 +318,8 @@ export default function CreateEncounterForm({
}}
/>

<Button type="submit" className="w-full">
Create Encounter
<Button type="submit" className="w-full" disabled={isPending}>
{isPending ? "Creating..." : "Create Encounter"}
</Button>
</form>
</Form>
Expand Down

0 comments on commit 7ffc0bd

Please sign in to comment.