mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-13 13:30:31 +08:00
fix(webdav): prevent dialog refresh loop and stabilize busy-state handling
This commit is contained in:
parent
35ae5cdba1
commit
a5de24a545
@ -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>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user