mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-18 00:11:08 +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";
|
} from "@mui/material";
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import type { ReactNode, Ref } from "react";
|
import type { ReactNode, Ref } from "react";
|
||||||
import { useImperativeHandle, useState } from "react";
|
import { useCallback, useImperativeHandle, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { BaseDialog, DialogRef } from "@/components/base";
|
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 (
|
return (
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
open={open}
|
open={open}
|
||||||
@ -206,7 +213,7 @@ export function BackupViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
|||||||
open={webdavDialogOpen}
|
open={webdavDialogOpen}
|
||||||
onClose={() => setWebdavDialogOpen(false)}
|
onClose={() => setWebdavDialogOpen(false)}
|
||||||
onBackupSuccess={() => openHistory("webdav")}
|
onBackupSuccess={() => openHistory("webdav")}
|
||||||
setBusy={(loading) => setBusyAction(loading ? "webdav" : null)}
|
setBusy={setWebdavBusy}
|
||||||
/>
|
/>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user