1+ import type { QueryClient } from "@tanstack/react-query" ;
12import {
23 CatchBoundary ,
34 createFileRoute ,
4- type InferAllContext ,
55 notFound ,
66 redirect ,
77} from "@tanstack/react-router" ;
88import { Actors } from "@/app/actors" ;
99import { BuildPrefiller } from "@/app/build-prefiller" ;
10- import { useDataProvider } from "@/components/actors" ;
10+ import {
11+ useDataProvider ,
12+ type useEngineCompatDataProvider ,
13+ } from "@/components/actors" ;
1114
1215export const Route = createFileRoute (
1316 "/_context/_cloud/orgs/$organization/projects/$project/ns/$namespace/" ,
@@ -18,15 +21,18 @@ export const Route = createFileRoute(
1821 throw notFound ( ) ;
1922 }
2023
21- const isVisible = await shouldDisplayActors ( context ) ;
24+ const shouldDisplay = await shouldDisplayActors ( context ) ;
2225
23- if ( ! isVisible ) {
26+ if ( ! shouldDisplay ) {
2427 throw redirect ( { from : Route . to , replace : true , to : "./connect" } ) ;
2528 }
2629 } ,
2730} ) ;
2831
29- async function shouldDisplayActors ( context : InferAllContext < typeof Route > ) {
32+ export async function shouldDisplayActors ( context : {
33+ queryClient : QueryClient ;
34+ dataProvider : ReturnType < typeof useEngineCompatDataProvider > ;
35+ } ) {
3036 try {
3137 const infiniteBuilds = await context . queryClient . fetchInfiniteQuery (
3238 context . dataProvider . buildsQueryOptions ( ) ,
@@ -65,16 +71,14 @@ export function RouteComponent() {
6571 }
6672
6773 return (
68- < >
69- < CatchBoundary getResetKey = { ( ) => actorId ?? "no-actor-id" } >
70- < Actors actorId = { actorId } />
71- < CatchBoundary
72- getResetKey = { ( ) => n ?. join ( "," ) ?? "no-build-name" }
73- errorComponent = { ( ) => null }
74- >
75- { ! n ? < BuildPrefiller /> : null }
76- </ CatchBoundary >
74+ < CatchBoundary getResetKey = { ( ) => actorId ?? "no-actor-id" } >
75+ < Actors actorId = { actorId } />
76+ < CatchBoundary
77+ getResetKey = { ( ) => n ?. join ( "," ) ?? "no-build-name" }
78+ errorComponent = { ( ) => null }
79+ >
80+ { ! n ? < BuildPrefiller /> : null }
7781 </ CatchBoundary >
78- </ >
82+ </ CatchBoundary >
7983 ) ;
8084}
0 commit comments