fix(EntityRow&FileRow): close loading window after download starts

This commit is contained in:
WittF 2025-06-21 21:23:35 +08:00
parent bb3a5f9908
commit 0a2a0df554
2 changed files with 12 additions and 2 deletions

View File

@ -51,7 +51,12 @@ const EntityRow = ({
setOpenLoading(true);
dispatch(getEntityUrl(entity?.id ?? 0))
.then((url) => {
entityLink ? (entityLink.location.href = url) : window.open(url, "_blank");
if (entityLink) {
entityLink.close();
window.open(url, "_blank");
} else {
window.open(url, "_blank");
}
})
.finally(() => {
setOpenLoading(false);

View File

@ -72,7 +72,12 @@ const FileRow = ({
fileLink?.document.write("Loading file URL...");
dispatch(getFileUrl(file?.id ?? 0))
.then((url) => {
fileLink ? (fileLink.location.href = url) : window.open(url, "_blank");
if (fileLink) {
fileLink.close();
window.open(url, "_blank");
} else {
window.open(url, "_blank");
}
})
.finally(() => {
setOpenLoading(false);