fix(Dialog): ensure navigation occurs after mount process completion (#273)

This commit is contained in:
Adam Shiervani 2025-03-19 18:12:49 +01:00 committed by GitHub
parent 439ef01687
commit f30eb0355e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -99,10 +99,9 @@ export function Dialog({ onClose }: { onClose: () => void }) {
}) })
.finally(() => { .finally(() => {
setMountInProgress(false); setMountInProgress(false);
});
navigate(".."); navigate("..");
}); });
});
} }
function handleStorageMount(fileName: string, mode: RemoteVirtualMediaState["mode"]) { function handleStorageMount(fileName: string, mode: RemoteVirtualMediaState["mode"]) {
@ -125,6 +124,7 @@ export function Dialog({ onClose }: { onClose: () => void }) {
// and the modal exit animation for like 500ms // and the modal exit animation for like 500ms
setTimeout(() => { setTimeout(() => {
setMountInProgress(false); setMountInProgress(false);
navigate("..");
}, 500); }, 500);
}); });
}); });
@ -155,6 +155,7 @@ export function Dialog({ onClose }: { onClose: () => void }) {
}) })
.finally(() => { .finally(() => {
setMountInProgress(false); setMountInProgress(false);
navigate("..");
}); });
}, },
); );
@ -839,7 +840,11 @@ function DeviceFileView({
onDelete={() => { onDelete={() => {
const selectedFile = onStorageFiles.find(f => f.name === file.name); const selectedFile = onStorageFiles.find(f => f.name === file.name);
if (!selectedFile) return; if (!selectedFile) return;
if (window.confirm("Are you sure you want to delete " + selectedFile.name + "?")) { if (
window.confirm(
"Are you sure you want to delete " + selectedFile.name + "?",
)
) {
handleDeleteFile(selectedFile); handleDeleteFile(selectedFile);
} }
}} }}