Skip to content

Commit c522420

Browse files
jog1tNathanFlurry
authored andcommitted
fix(fe): broken ui when no runner under name is available
1 parent 121dfe4 commit c522420

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed

frontend/src/components/actors/actor-general.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
3939
</Dd>
4040
<Dt>ID</Dt>
4141
<Dd className="text-mono">
42-
<DiscreteCopyButton size="xs" value={actorId}>
42+
<DiscreteCopyButton
43+
size="xs"
44+
value={actorId}
45+
className="-mx-2"
46+
>
4347
{actorId}
4448
</DiscreteCopyButton>
4549
</Dd>
@@ -64,6 +68,7 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
6468
<DiscreteCopyButton
6569
size="xs"
6670
value={createdAt ? formatISO(createdAt) : "n/a"}
71+
className="-mx-2"
6772
>
6873
{createdAt ? formatISO(createdAt) : "n/a"}
6974
</DiscreteCopyButton>
@@ -81,6 +86,7 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
8186
? formatISO(pendingAllocationAt)
8287
: "n/a"
8388
}
89+
className="-mx-2"
8490
>
8591
{pendingAllocationAt
8692
? formatISO(pendingAllocationAt)
@@ -95,6 +101,7 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
95101
>
96102
<DiscreteCopyButton
97103
size="xs"
104+
className="-mx-2"
98105
value={
99106
connectableAt ? formatISO(connectableAt) : "n/a"
100107
}
@@ -108,6 +115,7 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
108115
>
109116
<DiscreteCopyButton
110117
size="xs"
118+
className="-mx-2"
111119
value={sleepingAt ? formatISO(sleepingAt) : "n/a"}
112120
>
113121
{sleepingAt ? formatISO(sleepingAt) : "n/a"}
@@ -121,6 +129,7 @@ export function ActorGeneral({ actorId }: ActorGeneralProps) {
121129
>
122130
<DiscreteCopyButton
123131
size="xs"
132+
className="-mx-2"
124133
value={destroyedAt ? formatISO(destroyedAt) : "n/a"}
125134
>
126135
{destroyedAt ? formatISO(destroyedAt) : "n/a"}

frontend/src/components/actors/actor-state-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function ActorStateTab({ actorId }: ActorStateTabProps) {
5858

5959
export function Info({ children }: PropsWithChildren) {
6060
return (
61-
<div className="flex-1 flex flex-col gap-2 items-center justify-center h-full text-center max-w-md mx-auto">
61+
<div className="flex-1 flex flex-col gap-2 items-center justify-center h-full text-center max-w-lg mx-auto">
6262
{children}
6363
</div>
6464
);

frontend/src/components/actors/guard-connectable-inspector.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ export function GuardConnectableInspector({
8282
<InspectorGuardContext.Provider
8383
value={
8484
<Info>
85-
Cannot start Actor, runners are out of capacity. Add
86-
more runners to run the Actor or increase runner
87-
capacity.
85+
<p>Cannot start Actor, runners are out of capacity.</p>
86+
<p>
87+
Add more runners to run the Actor or increase runner
88+
capacity.
89+
</p>
8890
</Info>
8991
}
9092
>

frontend/src/queries/manager-engine.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
ActorQueryOptionsSchema,
1919
createDefaultManagerContext,
2020
} from "@/components/actors/manager-context";
21-
import { shouldRetryAllExpect403, throwAllExpect403 } from "./utils";
21+
import { noThrow, shouldRetryAllExpect403 } from "./utils";
2222

2323
export const createClient = (opts: { token: (() => string) | string }) =>
2424
new RivetClient({
@@ -53,7 +53,7 @@ export const createEngineManagerContext = ({
5353
return true;
5454
},
5555
retry: shouldRetryAllExpect403,
56-
throwOnError: throwAllExpect403,
56+
throwOnError: noThrow,
5757
meta: {
5858
mightRequireAuth: true,
5959
},
@@ -74,7 +74,7 @@ export const createEngineManagerContext = ({
7474
};
7575
},
7676
retry: shouldRetryAllExpect403,
77-
throwOnError: throwAllExpect403,
77+
throwOnError: noThrow,
7878
meta: {
7979
mightRequireAuth: true,
8080
},
@@ -100,7 +100,7 @@ export const createEngineManagerContext = ({
100100
throw new Error(`Region not found: ${regionId}`);
101101
},
102102
retry: shouldRetryAllExpect403,
103-
throwOnError: throwAllExpect403,
103+
throwOnError: noThrow,
104104
meta: {
105105
mightRequireAuth: true,
106106
},
@@ -124,7 +124,7 @@ export const createEngineManagerContext = ({
124124
return transformActor(data.actors[0]);
125125
},
126126
retry: shouldRetryAllExpect403,
127-
throwOnError: throwAllExpect403,
127+
throwOnError: noThrow,
128128
meta: {
129129
mightRequireAuth: true,
130130
},
@@ -199,7 +199,7 @@ export const createEngineManagerContext = ({
199199
return lastPage.pagination.cursor;
200200
},
201201
retry: shouldRetryAllExpect403,
202-
throwOnError: throwAllExpect403,
202+
throwOnError: noThrow,
203203
meta: {
204204
mightRequireAuth: true,
205205
},
@@ -237,7 +237,7 @@ export const createEngineManagerContext = ({
237237
return lastPage.pagination.cursor;
238238
},
239239
retry: shouldRetryAllExpect403,
240-
throwOnError: throwAllExpect403,
240+
throwOnError: noThrow,
241241
meta: {
242242
mightRequireAuth: true,
243243
},
@@ -260,7 +260,7 @@ export const createEngineManagerContext = ({
260260
return response.actor.actorId;
261261
},
262262
onSuccess: () => {},
263-
throwOnError: throwAllExpect403,
263+
throwOnError: noThrow,
264264
retry: shouldRetryAllExpect403,
265265
meta: {
266266
mightRequireAuth: true,
@@ -270,7 +270,7 @@ export const createEngineManagerContext = ({
270270
actorDestroyMutationOptions(actorId) {
271271
return {
272272
...def.actorDestroyMutationOptions(actorId),
273-
throwOnError: throwAllExpect403,
273+
throwOnError: noThrow,
274274
retry: shouldRetryAllExpect403,
275275
meta: {
276276
mightRequireAuth: true,
@@ -309,7 +309,7 @@ export const runnersQueryOptions = (opts: { namespace: NamespaceNameId }) => {
309309
},
310310
select: (data) => data.pages.flatMap((page) => page.runners),
311311
retry: shouldRetryAllExpect403,
312-
throwOnError: throwAllExpect403,
312+
throwOnError: noThrow,
313313
meta: {
314314
mightRequireAuth: true,
315315
},
@@ -333,7 +333,7 @@ export const runnerQueryOptions = (opts: {
333333
);
334334
return data.runner;
335335
},
336-
throwOnError: throwAllExpect403,
336+
throwOnError: noThrow,
337337
retry: shouldRetryAllExpect403,
338338
meta: {
339339
mightRequireAuth: true,
@@ -360,7 +360,7 @@ export const runnerByNameQueryOptions = (opts: {
360360
}
361361
return data.runners[0];
362362
},
363-
throwOnError: throwAllExpect403,
363+
throwOnError: noThrow,
364364
retry: shouldRetryAllExpect403,
365365
meta: {
366366
mightRequireAuth: true,
@@ -394,7 +394,7 @@ export const runnerNamesQueryOptions = (opts: {
394394
return lastPage.pagination.cursor;
395395
},
396396
select: (data) => data.pages.flatMap((page) => page.names),
397-
throwOnError: throwAllExpect403,
397+
throwOnError: noThrow,
398398
retry: shouldRetryAllExpect403,
399399
meta: {
400400
mightRequireAuth: true,
@@ -423,7 +423,7 @@ export const namespacesQueryOptions = () => {
423423
return lastPage.pagination.cursor;
424424
},
425425
select: (data) => data.pages.flatMap((page) => page.namespaces),
426-
throwOnError: throwAllExpect403,
426+
throwOnError: noThrow,
427427
retry: shouldRetryAllExpect403,
428428
meta: {
429429
mightRequireAuth: true,
@@ -447,7 +447,7 @@ export const namespaceQueryOptions = (
447447
: skipToken,
448448

449449
retry: shouldRetryAllExpect403,
450-
throwOnError: throwAllExpect403,
450+
throwOnError: noThrow,
451451
meta: {
452452
mightRequireAuth: true,
453453
},

frontend/src/queries/utils.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,9 @@ export const shouldRetryAllExpect403 = (failureCount: number, error: Error) => {
1515
return true;
1616
};
1717

18-
export const throwAllExpect403 = <T extends Query<any, any, any, any>>(
18+
export const noThrow = <T extends Query<any, any, any, any>>(
1919
error: Error,
20-
_query: T,
20+
query: T,
2121
) => {
22-
if (error && "statusCode" in error) {
23-
if (error.statusCode === 403) {
24-
// Don't throw on auth errors
25-
return false;
26-
}
27-
}
28-
29-
return true;
22+
return false;
3023
};

0 commit comments

Comments
 (0)