Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Close file tab on delete (#111)

Hakan Shehu5e48910a0559
diff --git a/packages/ui/src/components/files/file-delete-dialog.tsx b/packages/ui/src/components/files/file-delete-dialog.tsx
index b35d75a1..b754c097 100644
--- a/packages/ui/src/components/files/file-delete-dialog.tsx
+++ b/packages/ui/src/components/files/file-delete-dialog.tsx
@@ -11,6 +11,7 @@ import {
} from '@colanode/ui/components/ui/alert-dialog';
import { Button } from '@colanode/ui/components/ui/button';
import { Spinner } from '@colanode/ui/components/ui/spinner';
+import { useLayout } from '@colanode/ui/contexts/layout';
import { useWorkspace } from '@colanode/ui/contexts/workspace';
import { useMutation } from '@colanode/ui/hooks/use-mutation';
@@ -26,6 +27,7 @@ export const FileDeleteDialog = ({
onOpenChange,
}: FileDeleteDialogProps) => {
const workspace = useWorkspace();
+ const layout = useLayout();
const { mutate, isPending } = useMutation();
return (
@@ -55,6 +57,7 @@ export const FileDeleteDialog = ({
},
onSuccess() {
onOpenChange(false);
+ layout.close(fileId);
},
onError(error) {
toast.error(error.message);