fix(trash): prevent empty trash dialog from closing before API call completes (#434)

AlertDialogAction from Radix UI auto-closes the dialog on click.
Added e.preventDefault() so the dialog stays open and shows the
'Deleting...' loading state until the operation finishes.

Fixes both desktop and mobile file browsers.
This commit is contained in:
Yiling-J
2026-09-29 10:40:13 +08:00
committed by GitHub
parent f2b0415580
commit 11d21444cf
3 changed files with 8 additions and 2 deletions
@@ -1258,7 +1258,8 @@ export function FileBrowser({
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
onClick={(e) => {
e.preventDefault()
emptyTrash()
}}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
@@ -654,7 +654,10 @@ export function MobileFileBrowser({
<AlertDialogFooter>
<AlertDialogCancel>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
onClick={() => emptyTrash()}
onClick={(e) => {
e.preventDefault()
emptyTrash()
}}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
disabled={isEmptyingTrash}
>