fix: add cascade delete for card-related foreign keys and invalidate … (#31)

* fix: add cascade delete for card-related foreign keys and invalidate workspace cache after deletion

* fix: use refetch instead of invalidate for workspace deletion to ensure immediate UI update

* feat: add cascade delete to card relations and activity tables
This commit is contained in:
LovelessCodes
2025-06-05 22:20:31 +02:00
committed by GitHub
parent 116fefcaf3
commit 2043a8f98c
5 changed files with 2189 additions and 11 deletions

View File

@@ -15,14 +15,19 @@ export function DeleteWorkspaceConfirmation() {
const [isAcknowledgmentChecked, setIsAcknowledgmentChecked] = useState(false);
const utils = api.useUtils();
const deleteWorkspaceMutation = api.workspace.delete.useMutation({
onSuccess: () => {
onSuccess: async () => {
closeModal();
showPopup({
header: "Workspace deleted",
message: "Your workspace has been deleted.",
icon: "success",
});
await utils.workspace.all.refetch();
const filteredWorkspaces = availableWorkspaces.filter(
(ws) => ws.publicId !== workspace.publicId,
);