File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
npm-packages/dashboard/src/hooks Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11import { useRouter } from "next/router" ;
2- import { useTeams } from "api/teams" ;
2+ import { useCurrentTeam } from "api/teams" ;
33import { PROVISION_PROD_PAGE_NAME } from "@common/lib/deploymentContext" ;
4- import { useProjectById } from "api/projects" ;
4+ import { useProjects } from "api/projects" ;
55
66export function useDeploymentUris (
77 projectId : number ,
@@ -11,9 +11,11 @@ export function useDeploymentUris(
1111 const router = useRouter ( ) ;
1212 const subroute =
1313 router . route . split ( "/t/[team]/[project]/[deploymentName]" ) [ 1 ] || "/" ;
14- const { selectedTeamSlug } = useTeams ( ) ;
14+ const team = useCurrentTeam ( ) ;
15+ const selectedTeamSlug = team ?. slug ;
1516
16- const project = useProjectById ( projectId ) ;
17+ // Instead of calling useProjectById, call useProjects because the data for that project is pre-fetched in SSR.
18+ const project = useProjects ( team ?. id ) ?. find ( ( p ) => p . id === projectId ) ;
1719 const prodDeploymentName = project ?. prodDeploymentName ;
1820 const devDeploymentName = project ?. devDeploymentName ;
1921
You can’t perform that action at this time.
0 commit comments