Fix project workspace detail route loading
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
2de691f023
commit
cbeefbfa5a
2 changed files with 5 additions and 2 deletions
|
|
@ -340,6 +340,8 @@ export function App() {
|
||||||
<Route path="projects/:projectId/overview" element={<UnprefixedBoardRedirect />} />
|
<Route path="projects/:projectId/overview" element={<UnprefixedBoardRedirect />} />
|
||||||
<Route path="projects/:projectId/issues" element={<UnprefixedBoardRedirect />} />
|
<Route path="projects/:projectId/issues" element={<UnprefixedBoardRedirect />} />
|
||||||
<Route path="projects/:projectId/issues/:filter" element={<UnprefixedBoardRedirect />} />
|
<Route path="projects/:projectId/issues/:filter" element={<UnprefixedBoardRedirect />} />
|
||||||
|
<Route path="projects/:projectId/workspaces" element={<UnprefixedBoardRedirect />} />
|
||||||
|
<Route path="projects/:projectId/workspaces/:workspaceId" element={<UnprefixedBoardRedirect />} />
|
||||||
<Route path="projects/:projectId/configuration" element={<UnprefixedBoardRedirect />} />
|
<Route path="projects/:projectId/configuration" element={<UnprefixedBoardRedirect />} />
|
||||||
<Route path="tests/ux/runs" element={<UnprefixedBoardRedirect />} />
|
<Route path="tests/ux/runs" element={<UnprefixedBoardRedirect />} />
|
||||||
<Route path=":companyPrefix" element={<Layout />}>
|
<Route path=":companyPrefix" element={<Layout />}>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { Link, useNavigate, useParams } from "@/lib/router";
|
import { Link, useNavigate, useParams } from "@/lib/router";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import type { ProjectWorkspace } from "@paperclipai/shared";
|
import { isUuidLike, type ProjectWorkspace } from "@paperclipai/shared";
|
||||||
import { ArrowLeft, Check, ExternalLink, Loader2, Sparkles } from "lucide-react";
|
import { ArrowLeft, Check, ExternalLink, Loader2, Sparkles } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
|
|
@ -186,10 +186,11 @@ export function ProjectWorkspaceDetail() {
|
||||||
}, [companies, companyPrefix]);
|
}, [companies, companyPrefix]);
|
||||||
|
|
||||||
const lookupCompanyId = routeCompanyId ?? selectedCompanyId ?? undefined;
|
const lookupCompanyId = routeCompanyId ?? selectedCompanyId ?? undefined;
|
||||||
|
const canFetchProject = routeProjectRef.length > 0 && (isUuidLike(routeProjectRef) || Boolean(lookupCompanyId));
|
||||||
const projectQuery = useQuery({
|
const projectQuery = useQuery({
|
||||||
queryKey: [...queryKeys.projects.detail(routeProjectRef), lookupCompanyId ?? null],
|
queryKey: [...queryKeys.projects.detail(routeProjectRef), lookupCompanyId ?? null],
|
||||||
queryFn: () => projectsApi.get(routeProjectRef, lookupCompanyId),
|
queryFn: () => projectsApi.get(routeProjectRef, lookupCompanyId),
|
||||||
enabled: routeProjectRef.length > 0,
|
enabled: canFetchProject,
|
||||||
});
|
});
|
||||||
|
|
||||||
const project = projectQuery.data ?? null;
|
const project = projectQuery.data ?? null;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue