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
+2
View File
@@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Fixed
- **trash**: Fix an issue where the "Empty Trash" confirmation dialog would close immediately instead of showing a loading state while files were being permanently deleted
### Changed
## [0.4.9] - 2026-09-28
@@ -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}
>