fix(documents): FolderActionsMenu — disable on pending + skip no-op rename
Pass loading={deleteMutation.isPending} to ConfirmationDialog so a
second tap on Delete doesn't dispatch a concurrent DELETE. Also
disable the rename Save button when the name hasn't changed, so an
accidental click doesn't fire a no-op PATCH and a misleading
"Folder renamed" toast.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,7 @@ export function FolderActionsMenu({ selectedFolderId, onAfterDelete }: FolderAct
|
|||||||
title="Delete folder?"
|
title="Delete folder?"
|
||||||
description="Subfolders and documents inside will move up to the parent. The folder itself is removed."
|
description="Subfolders and documents inside will move up to the parent. The folder itself is removed."
|
||||||
confirmLabel="Delete folder"
|
confirmLabel="Delete folder"
|
||||||
|
loading={deleteMutation.isPending}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
try {
|
try {
|
||||||
await deleteMutation.mutateAsync(selectedFolderId as string);
|
await deleteMutation.mutateAsync(selectedFolderId as string);
|
||||||
@@ -181,7 +182,9 @@ export function FolderActionsMenu({ selectedFolderId, onAfterDelete }: FolderAct
|
|||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={!name.trim() || renameMutation.isPending}
|
disabled={
|
||||||
|
!name.trim() || name.trim() === currentName || renameMutation.isPending
|
||||||
|
}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
try {
|
try {
|
||||||
await renameMutation.mutateAsync({
|
await renameMutation.mutateAsync({
|
||||||
|
|||||||
Reference in New Issue
Block a user