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: duplicate projects fetch on load

LAZIC Erwan7e06bc0d6ac3
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId.tsx
index fb25b71de..f5a781d6a 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId.tsx
@@ -4,14 +4,15 @@ import getProjects from "@/fetchers/project/get-projects";
export const Route = createFileRoute(
"/_layout/_authenticated/dashboard/workspace/$workspaceId",
)({
- beforeLoad: async ({ params, location }) => {
+ beforeLoad: async ({ params, location, context }) => {
const currentPath = location.pathname.replace(/\/+$/, "");
const workspacePath = `/dashboard/workspace/${params.workspaceId}`;
if (currentPath !== workspacePath) return;
- const projects = await getProjects({
- workspaceId: params.workspaceId,
+ const projects = await context.queryClient.ensureQueryData({
+ queryKey: ["projects", params.workspaceId],
+ queryFn: () => getProjects({ workspaceId: params.workspaceId }),
});
if (projects?.length !== 1) return;