mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 16:21:16 +00:00
fix: invalidte dir content when moving dir items
This commit is contained in:
@@ -38,16 +38,21 @@ export function useFileDrop({
|
||||
const setDragInfo = useSetAtom(dragInfoAtom)
|
||||
const store = useStore()
|
||||
|
||||
const moveDirectoryItemsMutation = useAtomValue(
|
||||
moveDirectoryItemsMutationAtom,
|
||||
)
|
||||
|
||||
const { mutate: moveDroppedItems } = useMutation({
|
||||
...useAtomValue(moveDirectoryItemsMutationAtom),
|
||||
onSuccess: (result: MoveDirectoryItemsResult) => {
|
||||
const conflictCount = result.conflicts.length
|
||||
...moveDirectoryItemsMutation,
|
||||
onSuccess: (data: MoveDirectoryItemsResult, vars, result, ctx) => {
|
||||
moveDirectoryItemsMutation.onSuccess?.(data, vars, result, ctx)
|
||||
const conflictCount = data.errors.length
|
||||
if (conflictCount > 0) {
|
||||
toast.warning(
|
||||
`${result.moved.length} items moved${conflictCount > 0 ? `, ${conflictCount} conflicts` : ""}`,
|
||||
`${data.moved.length} items moved${conflictCount > 0 ? `, ${conflictCount} conflicts` : ""}`,
|
||||
)
|
||||
} else {
|
||||
toast.success(`${result.moved.length} items moved!`)
|
||||
toast.success(`${data.moved.length} items moved!`)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user