11import { faPowerOff , faSpinnerThird , Icon } from "@rivet-gg/icons" ;
2- import { useMutation , useQuery , useSuspenseQuery } from "@tanstack/react-query" ;
3- import { useMatch } from "@tanstack/react-router" ;
42import {
5- createContext ,
6- type ReactNode ,
7- useContext ,
8- useMemo ,
9- useState ,
10- } from "react" ;
3+ useInfiniteQuery ,
4+ useMutation ,
5+ useQuery ,
6+ useSuspenseQuery ,
7+ } from "@tanstack/react-query" ;
8+ import { useMatch } from "@tanstack/react-router" ;
9+ import { createContext , type ReactNode , useContext , useMemo } from "react" ;
1110import { useInspectorCredentials } from "@/app/credentials-context" ;
1211import { createInspectorActorContext } from "@/queries/actor-inspector" ;
1312import { DiscreteCopyButton } from "../copy-area" ;
@@ -87,17 +86,7 @@ export function GuardConnectableInspector({
8786
8887 if ( pendingAllocationAt && ! startedAt ) {
8988 return (
90- < InspectorGuardContext . Provider
91- value = {
92- < Info >
93- < p > Cannot start Actor, runners are out of capacity.</ p >
94- < p >
95- Add more runners to run the Actor or increase runner
96- capacity.
97- </ p >
98- </ Info >
99- }
100- >
89+ < InspectorGuardContext . Provider value = { < NoRunners /> } >
10190 { children }
10291 </ InspectorGuardContext . Provider >
10392 ) ;
@@ -110,6 +99,33 @@ export function GuardConnectableInspector({
11099 ) ;
111100}
112101
102+ function NoRunners ( ) {
103+ const { data } = useInfiniteQuery ( {
104+ ...useEngineCompatDataProvider ( ) . runnersQueryOptions ( ) ,
105+ refetchInterval : 5_000 ,
106+ } ) ;
107+
108+ if ( data ?. length === 0 ) {
109+ return (
110+ < Info >
111+ < p > There are no runners.</ p >
112+ < p >
113+ Check that you have at least one runner available to run
114+ your Actors.
115+ </ p >
116+ </ Info >
117+ ) ;
118+ }
119+ return (
120+ < Info >
121+ < p > Cannot start Actor, runners are out of capacity.</ p >
122+ < p >
123+ Add more runners to run the Actor or increase runner capacity.
124+ </ p >
125+ </ Info >
126+ ) ;
127+ }
128+
113129function ActorContextProvider ( props : {
114130 actorId : ActorId ;
115131 children : ReactNode ;
0 commit comments