-
Notifications
You must be signed in to change notification settings - Fork 4
Description
In my use case where I'm using this as a video file explorer, I used api.intercept on "delete-files" in order to show my own custom confirmation modal for deleting videos (example below). However, because of this I end up getting two confirmation modals (see pictures).
api.intercept("delete-files", ({ ids }) => {
// Map file-manager IDs to their full VideoData items (skip folders / not-found)
const fullItems = ids
.map((id) => fileData.find((videoItem) => videoItem.id === id))
.filter((item): item is VideoData => item != null && item.type === "file")
// Populate state and open the confirmation modal
setVideosForDeletion(fullItems)
deleteVideosDialogRef.current?.showModal()
return false // Return false to prevent the file-manager from handling the delete itself, see https://docs.svar.dev/react/filemanager/api/actions/delete-files
})Built-in confirmation modal (shows first)

My custom confirmation modal (shows after clicking "OK" in the previous modal)

My first thought was maybe there's a way of creating custom actions? That way I can define a new action that basically performs the same what "delete-files" does except without the confirmation modal. I couldn't quite find anything here though. Another idea is if there was some way I could pass a skipDeleteConfirmation prop somewhere.
Overall this is a pretty small issue since it just means my users need to click through a second confirmation modal. But any help would still be appreciated!