@@ -23,9 +23,9 @@ export type Namespace = {
23
23
createdAt : string ;
24
24
} ;
25
25
26
- export function createClient ( ) {
26
+ export function createClient ( baseUrl = engineEnv ( ) . VITE_APP_API_URL ) {
27
27
return new RivetClient ( {
28
- baseUrl : ( ) => engineEnv ( ) . VITE_APP_API_URL ,
28
+ baseUrl : ( ) => baseUrl ,
29
29
environment : "" ,
30
30
} ) ;
31
31
}
@@ -108,6 +108,10 @@ export const createNamespaceContext = ({
108
108
statusQueryOptions ( ) {
109
109
return queryOptions ( {
110
110
...def . statusQueryOptions ( ) ,
111
+ queryKey : [
112
+ { namespace, namespaceId } ,
113
+ ...def . statusQueryOptions ( ) . queryKey ,
114
+ ] ,
111
115
enabled : true ,
112
116
queryFn : async ( ) => {
113
117
return true ;
@@ -118,6 +122,10 @@ export const createNamespaceContext = ({
118
122
return infiniteQueryOptions ( {
119
123
...def . regionsQueryOptions ( ) ,
120
124
enabled : true ,
125
+ queryKey : [
126
+ { namespace, namespaceId } ,
127
+ ...def . regionsQueryOptions ( ) . queryKey ,
128
+ ] ,
121
129
queryFn : async ( ) => {
122
130
const data = await client . datacenters . list ( ) ;
123
131
return {
@@ -133,7 +141,10 @@ export const createNamespaceContext = ({
133
141
regionQueryOptions ( regionId : string | undefined ) {
134
142
return queryOptions ( {
135
143
...def . regionQueryOptions ( regionId ) ,
136
- queryKey : [ "region" , regionId ] ,
144
+ queryKey : [
145
+ { namespace, namespaceId } ,
146
+ ...def . regionQueryOptions ( regionId ) . queryKey ,
147
+ ] ,
137
148
queryFn : async ( { client } ) => {
138
149
const regions = await client . ensureInfiniteQueryData (
139
150
this . regionsQueryOptions ( ) ,
@@ -154,7 +165,10 @@ export const createNamespaceContext = ({
154
165
actorQueryOptions ( actorId ) {
155
166
return queryOptions ( {
156
167
...def . actorQueryOptions ( actorId ) ,
157
- queryKey : [ namespace , "actor" , actorId ] ,
168
+ queryKey : [
169
+ { namespace, namespaceId } ,
170
+ ...def . actorQueryOptions ( actorId ) . queryKey ,
171
+ ] ,
158
172
enabled : true ,
159
173
queryFn : async ( { signal : abortSignal } ) => {
160
174
const data = await client . actorsGet (
@@ -170,7 +184,10 @@ export const createNamespaceContext = ({
170
184
actorsQueryOptions ( opts ) {
171
185
return infiniteQueryOptions ( {
172
186
...def . actorsQueryOptions ( opts ) ,
173
- queryKey : [ namespace , "actors" , opts ] ,
187
+ queryKey : [
188
+ { namespace, namespaceId } ,
189
+ ...def . actorsQueryOptions ( opts ) . queryKey ,
190
+ ] ,
174
191
enabled : true ,
175
192
initialPageParam : undefined ,
176
193
queryFn : async ( {
@@ -237,7 +254,10 @@ export const createNamespaceContext = ({
237
254
buildsQueryOptions ( ) {
238
255
return infiniteQueryOptions ( {
239
256
...def . buildsQueryOptions ( ) ,
240
- queryKey : [ namespace , "builds" ] ,
257
+ queryKey : [
258
+ { namespace, namespaceId } ,
259
+ ...def . buildsQueryOptions ( ) . queryKey ,
260
+ ] ,
241
261
enabled : true ,
242
262
queryFn : async ( { signal : abortSignal , pageParam } ) => {
243
263
const data = await client . actorsListNames (
@@ -402,16 +422,14 @@ export const createNamespaceContext = ({
402
422
initialPageParam : undefined as string | undefined ,
403
423
queryFn : async ( { signal : abortSignal , pageParam } ) => {
404
424
const response = await client . namespacesRunnerConfigs . list (
405
- namespaceId ,
425
+ namespace ,
406
426
{
407
427
cursor : pageParam ?? undefined ,
408
428
limit : RECORDS_PER_PAGE ,
409
429
} ,
410
430
{ abortSignal } ,
411
431
) ;
412
432
413
- console . log ( response ) ;
414
-
415
433
return response ;
416
434
} ,
417
435
0 commit comments