fix(webdav): prevent dialog refresh loop and stabilize busy-state handling

This commit is contained in:
Slinetrac 2025-11-17 18:16:13 +08:00
parent 35ae5cdba1
commit a5de24a545
No known key found for this signature in database

View File

@ -9,7 +9,7 @@ import {
} from "@mui/material";
import { useLockFn } from "ahooks";
import type { ReactNode, Ref } from "react";
import { useImperativeHandle, useState } from "react";
import { useCallback, useImperativeHandle, useState } from "react";
import { useTranslation } from "react-i18next";
import { BaseDialog, DialogRef } from "@/components/base";
@ -67,6 +67,13 @@ export function BackupViewer({ ref }: { ref?: Ref<DialogRef> }) {
}
});
const setWebdavBusy = useCallback(
(loading: boolean) => {
setBusyAction(loading ? "webdav" : null);
},
[setBusyAction],
);
return (
<BaseDialog
open={open}
@ -206,7 +213,7 @@ export function BackupViewer({ ref }: { ref?: Ref<DialogRef> }) {
open={webdavDialogOpen}
onClose={() => setWebdavDialogOpen(false)}
onBackupSuccess={() => openHistory("webdav")}
setBusy={(loading) => setBusyAction(loading ? "webdav" : null)}
setBusy={setWebdavBusy}
/>
</BaseDialog>
);