Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions components/documents/actions/delete-documents-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { useTeam } from "@/context/team-context";
import { toast } from "sonner";
import { mutate } from "swr";

import { useAnalytics } from "@/lib/analytics";

import { Button } from "@/components/ui/button";
import { DialogDescription, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Modal } from "@/components/ui/modal";

import { useAnalytics } from "@/lib/analytics";

function DeleteItemsModal({
showDeleteItemsModal,
setShowDeleteItemsModal,
Expand Down Expand Up @@ -51,9 +51,6 @@ function DeleteItemsModal({
setIsValid(false);
}
};
const parentFolderPath = folderPathName
?.join("/")
?.substring(0, folderPathName?.lastIndexOf("/"));

async function deleteDocumentsAndFolders(
documentIds: string[],
Expand Down Expand Up @@ -135,11 +132,12 @@ function DeleteItemsModal({
`/api/teams/${teamInfo?.currentTeam?.id}/folders?root=true`,
);
await mutate(`/api/teams/${teamInfo?.currentTeam?.id}/folders`);
await mutate(
`/api/teams/${teamInfo?.currentTeam?.id}/folders${parentFolderPath}`,
);

if (folderPathName && folderPathName.length > 0) {
await mutate(
`/api/teams/${
teamInfo?.currentTeam?.id
}/folders/${folderPathName.join("/")}`,
);
await mutate(
`/api/teams/${
teamInfo?.currentTeam?.id
Expand Down