diff --git a/src/components/settings/advanced-section.tsx b/src/components/settings/advanced-section.tsx index 279af5388..ef993b414 100644 --- a/src/components/settings/advanced-section.tsx +++ b/src/components/settings/advanced-section.tsx @@ -235,10 +235,12 @@ function DataResetCard() { const { t } = useTranslations(); const queryClient = useQueryClient(); const [deleting, setDeleting] = useState(false); + const [confirmOpen, setConfirmOpen] = useState(false); const [msg, setMsg] = useState(null); const [msgType, setMsgType] = useState<"success" | "error" | null>(null); async function handleDeleteAllData() { + if (deleting) return; setDeleting(true); setMsg(null); setMsgType(null); @@ -258,6 +260,7 @@ function DataResetCard() { await queryClient.invalidateQueries(); setMsg(t("settings.dangerZoneSuccess")); setMsgType("success"); + setConfirmOpen(false); } catch { setMsg(t("settings.dangerZoneDeleteFailed")); setMsgType("error"); @@ -285,7 +288,16 @@ function DataResetCard() { {t("settings.dangerZoneDescription")}

- + { + // Hold the dialog open while the destructive mutation is in + // flight so the in-dialog pending state stays visible and a + // stray backdrop tap can't dismiss it mid-request. + if (deleting) return; + setConfirmOpen(open); + }} + >