Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): refetch visible subtask lists after a delete

irfanfaraazdf8b4df78c38
diff --git a/apps/web/src/hooks/mutations/task/remove-task-from-relations.test.ts b/apps/web/src/hooks/mutations/task/remove-task-from-relations.test.ts
index bb3872f88..8c2542cb2 100644
--- a/apps/web/src/hooks/mutations/task/remove-task-from-relations.test.ts
+++ b/apps/web/src/hooks/mutations/task/remove-task-from-relations.test.ts
@@ -33,5 +33,8 @@ describe("removeTasksFromRelations", () => {
expect(
queryClient.getQueryData(["task-relations", "sub-a"]),
).toBeUndefined();
+ expect(
+ queryClient.getQueryState(["task-relations", "parent"])?.isInvalidated,
+ ).toBe(true);
});
});
diff --git a/apps/web/src/hooks/mutations/task/remove-task-from-relations.ts b/apps/web/src/hooks/mutations/task/remove-task-from-relations.ts
index 630d2c0b5..9365e9f4c 100644
--- a/apps/web/src/hooks/mutations/task/remove-task-from-relations.ts
+++ b/apps/web/src/hooks/mutations/task/remove-task-from-relations.ts
@@ -26,4 +26,7 @@ export function removeTasksFromRelations(
!deleted.has(relation.targetTaskId),
),
);
+
+ // Restart any relation fetch still in flight so it can't write the old list back.
+ void queryClient.invalidateQueries({ queryKey: ["task-relations"] });
}