mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
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:
@@ -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}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user