fix(medications): show a pending spinner on the intake-edit save button

The intake-edit dialog already tracks a busy state and sets aria-busy, but
the Save button gave no visual feedback while the PUT was in flight, unlike
the wizard and quick-add. Render the same inline spinner during the
mutation.
This commit is contained in:
Marc-André Bombeck committed 2026-06-04 15:36:12 +02:00
1 parent 8434af40cb
commit 0c3c80a4f6
1 file changed
+9 -1
@@ -16,6 +16,7 @@
import { useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import { Loader2 } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
@@ -174,7 +175,14 @@ function IntakeEditDialogBody({
<Button variant="outline" onClick={onClose} disabled={busy}>
{t("medications.detail.intake.edit.cancel")}
</Button>
<Button onClick={() => void save()} disabled={busy} aria-busy={busy || undefined}>
<Button
onClick={() => void save()}
disabled={busy}
aria-busy={busy || undefined}
>
{busy && (
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
)}
{t("medications.detail.intake.edit.save")}
</Button>
</DialogFooter>