1
1
import { faPowerOff , faSpinnerThird , Icon } from "@rivet-gg/icons" ;
2
- import { useMutation , useQuery , useSuspenseQuery } from "@tanstack/react-query" ;
3
- import { useMatch } from "@tanstack/react-router" ;
4
2
import {
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" ;
11
10
import { useInspectorCredentials } from "@/app/credentials-context" ;
12
11
import { createInspectorActorContext } from "@/queries/actor-inspector" ;
13
12
import { DiscreteCopyButton } from "../copy-area" ;
@@ -87,17 +86,7 @@ export function GuardConnectableInspector({
87
86
88
87
if ( pendingAllocationAt && ! startedAt ) {
89
88
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 /> } >
101
90
{ children }
102
91
</ InspectorGuardContext . Provider >
103
92
) ;
@@ -110,6 +99,33 @@ export function GuardConnectableInspector({
110
99
) ;
111
100
}
112
101
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
+
113
129
function ActorContextProvider ( props : {
114
130
actorId : ActorId ;
115
131
children : ReactNode ;
0 commit comments