Skip to content

Commit 23c76be

Browse files
committed
fix: load aurrent actor if its outside of current pagination window (#2772)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved handling of loading and error states when accessing actor details, providing clearer feedback to users during data retrieval. * Introduced a loading indicator (shimmer effect) when actor information is being fetched, replacing the static "not found" message. * Ensured the current actor is always included in the actors list for consistent state management. * **Style** * Enhanced the display of hostnames in the network ports list for better text truncation and layout. * **Chores** * Updated internal configuration by removing unused MDX plugin settings. * Added local packaging of core actor functionality for streamlined dependency management. * Removed deprecated development script for actor-core preparation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 3493a1d commit 23c76be

9 files changed

Lines changed: 353 additions & 278 deletions

File tree

frontend/apps/hub/src/domains/project/components/actors/actors-provider.tsx

Lines changed: 305 additions & 174 deletions
Large diffs are not rendered by default.

frontend/apps/hub/vite.config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import react from "@vitejs/plugin-react";
77
import { visualizer } from "rollup-plugin-visualizer";
88
import { defineConfig } from "vite";
99
import vitePluginFaviconsInject from "vite-plugin-favicons-inject";
10-
// @ts-ignore
11-
import { config as mdxConfig } from "../../../site/src/mdx/mdx.mjs";
1210

1311
// These are only needed in CI. They'll be undefined in dev.
1412
const GIT_BRANCH = process.env.CF_PAGES_BRANCH;
@@ -18,13 +16,6 @@ const GIT_SHA = process.env.CF_PAGES_COMMIT_SHA;
1816
export default defineConfig({
1917
base: "./",
2018
plugins: [
21-
{
22-
enforce: "pre",
23-
...mdx({
24-
remarkPlugins: mdxConfig.options.remarkPlugins,
25-
rehypePlugins: mdxConfig.options.rehypePlugins,
26-
}),
27-
},
2819
react(),
2920
TanStackRouterVite(),
3021
vitePluginFaviconsInject(

frontend/packages/actor-core.tgz

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:5ddf59824be261c166d00af05b1f1129f8d6440ed4556788ca4065b0c6244cc2
3+
size 308996

frontend/packages/components/src/actors/actor-context.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ export type Region = Rivet.actor.Region;
8484

8585
// global atoms
8686
export const currentActorIdAtom = atom<string | undefined>(undefined);
87+
88+
export const currentActorQueryAtom = atom<{
89+
isLoading: boolean;
90+
error: string | null;
91+
}>({
92+
isLoading: false,
93+
error: null,
94+
});
8795
export const actorsQueryAtom = atom<{
8896
isLoading: boolean;
8997
error: string | null;

frontend/packages/components/src/actors/actor-network.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ export function ActorNetwork({ actor }: ActorNetworkProps) {
8181
<Dd>
8282
<DiscreteCopyButton
8383
size="xs"
84-
className="max-w-full min-w-0"
84+
className="max-w-full"
8585
value={port.hostname || ""}
8686
>
87-
{port.hostname}
87+
<span className=" min-w-0 truncate flex-1">
88+
{port.hostname}
89+
</span>
8890
</DiscreteCopyButton>
8991
</Dd>
9092
{port.url ? (

frontend/packages/components/src/actors/actor-not-found.tsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { selectAtom } from "jotai/utils";
44
import { useCallback } from "react";
55
import { Button } from "../ui/button";
66
import { FilterOp } from "../ui/filters";
7-
import { type ActorFeature, actorFiltersAtom } from "./actor-context";
7+
import {
8+
type ActorFeature,
9+
actorFiltersAtom,
10+
currentActorQueryAtom,
11+
} from "./actor-context";
812
import { ActorTabs } from "./actors-actor-details";
913
import { useActorsView } from "./actors-view-context-provider";
14+
import { ShimmerLine } from "../shimmer-line";
1015

1116
export function ActorNotFound({
1217
features = [],
@@ -21,17 +26,28 @@ export function ActorNotFound({
2126
),
2227
);
2328

29+
const { isLoading } = useAtomValue(currentActorQueryAtom);
30+
2431
return (
2532
<div className="flex flex-col h-full flex-1">
26-
<ActorTabs disabled features={features}>
27-
<div className="flex text-center text-foreground flex-1 justify-center items-center flex-col gap-2">
28-
<Icon icon={faQuestionSquare} className="text-4xl" />
29-
<p className="max-w-[400px]">{copy.actorNotFound}</p>
30-
<p className="max-w-[400px] text-sm text-muted-foreground">
31-
{copy.actorNotFoundDescription}
32-
</p>
33+
<ActorTabs disabled features={features} className="relative">
34+
<div className="flex text-center text-foreground flex-1 justify-center items-center flex-col relative gap-2">
35+
{!isLoading ? (
36+
<>
37+
<Icon
38+
icon={faQuestionSquare}
39+
className="text-4xl"
40+
/>
41+
<p className="max-w-[400px]">
42+
{copy.actorNotFound}
43+
</p>
44+
<p className="max-w-[400px] text-sm text-muted-foreground">
45+
{copy.actorNotFoundDescription}
46+
</p>
47+
</>
48+
) : null}
3349

34-
{!hasDevMode ? (
50+
{!hasDevMode && !isLoading ? (
3551
<Button
3652
className="mt-3"
3753
variant="outline"
@@ -49,6 +65,7 @@ export function ActorNotFound({
4965
{copy.showHiddenActors}
5066
</Button>
5167
) : null}
68+
{isLoading ? <ShimmerLine className="top-0" /> : null}
5269
</div>
5370
</ActorTabs>
5471
</div>

frontend/scripts/prepare-cf.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"resolutions": {
2828
"react": "^19",
2929
"react-dom": "^19",
30-
"esbuild": "^0.25.5"
30+
"esbuild": "^0.25.5",
31+
"actor-core": "file:./frontend/packages/actor-core.tgz"
3132
}
3233
}

yarn.lock

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,6 @@ __metadata:
146146
languageName: node
147147
linkType: hard
148148

149-
"@asteasolutions/zod-to-openapi@npm:^7.3.0":
150-
version: 7.3.3
151-
resolution: "@asteasolutions/zod-to-openapi@npm:7.3.3"
152-
dependencies:
153-
openapi3-ts: "npm:^4.1.2"
154-
peerDependencies:
155-
zod: ^3.20.2
156-
checksum: 10c0/8c097609fa40088d76c32ab65582b73f24578cfc383090ee78a718a9e1ef442f7b6aecaa853cdff92ad6b70d8b9961613a10e8bbd14cba79e381b590cf53a68d
157-
languageName: node
158-
linkType: hard
159-
160149
"@aws-crypto/crc32@npm:5.2.0":
161150
version: 5.2.0
162151
resolution: "@aws-crypto/crc32@npm:5.2.0"
@@ -1678,29 +1667,6 @@ __metadata:
16781667
languageName: node
16791668
linkType: hard
16801669

1681-
"@hono/zod-openapi@npm:^0.19.6":
1682-
version: 0.19.8
1683-
resolution: "@hono/zod-openapi@npm:0.19.8"
1684-
dependencies:
1685-
"@asteasolutions/zod-to-openapi": "npm:^7.3.0"
1686-
"@hono/zod-validator": "npm:^0.7.0"
1687-
peerDependencies:
1688-
hono: ">=4.3.6"
1689-
zod: 3.*
1690-
checksum: 10c0/f2af759a18d784908ff220685f1eafb4aaaf8933dbd1aa268dc0a42aa3f104a32865d46d0e01f8511cd47d224c509de2d03254539b1f9de5a5886610cf0f86ca
1691-
languageName: node
1692-
linkType: hard
1693-
1694-
"@hono/zod-validator@npm:^0.7.0":
1695-
version: 0.7.0
1696-
resolution: "@hono/zod-validator@npm:0.7.0"
1697-
peerDependencies:
1698-
hono: ">=3.9.0"
1699-
zod: ^3.25.0
1700-
checksum: 10c0/8e362358348ef84a889ada450bba0a0c5b6109dacf74189153622f947e1fb66e161ef8772f169efe49d737e837d490c33efbbe094e5bb3e7a55dccd62848acd6
1701-
languageName: node
1702-
linkType: hard
1703-
17041670
"@hookform/resolvers@npm:^3.3.4, @hookform/resolvers@npm:^3.9.0":
17051671
version: 3.10.0
17061672
resolution: "@hookform/resolvers@npm:3.10.0"
@@ -7500,11 +7466,10 @@ __metadata:
75007466
languageName: node
75017467
linkType: hard
75027468

7503-
"actor-core@npm:0.9.0-rc.1":
7504-
version: 0.9.0-rc.1
7505-
resolution: "actor-core@npm:0.9.0-rc.1"
7469+
"actor-core@file:./frontend/packages/actor-core.tgz::locator=rivet%40workspace%3A.":
7470+
version: 0.7.7
7471+
resolution: "actor-core@file:./frontend/packages/actor-core.tgz#./frontend/packages/actor-core.tgz::hash=cf9e1e&locator=rivet%40workspace%3A."
75067472
dependencies:
7507-
"@hono/zod-openapi": "npm:^0.19.6"
75087473
cbor-x: "npm:^1.6.0"
75097474
hono: "npm:^4.7.0"
75107475
invariant: "npm:^2.2.4"
@@ -7521,30 +7486,7 @@ __metadata:
75217486
optional: true
75227487
bin:
75237488
actor-core: ./dist/cli/mod.cjs
7524-
checksum: 10c0/07db1f0a783e53f25a7814da427203578748ca41ad5e35e648d071ad9e742dbe74eefd4f60e878aaa278de2e750def6f9b287d0942bed8928c8e7516bee06e18
7525-
languageName: node
7526-
linkType: hard
7527-
7528-
"actor-core@npm:^0.6.2":
7529-
version: 0.6.3
7530-
resolution: "actor-core@npm:0.6.3"
7531-
dependencies:
7532-
cbor-x: "npm:^1.6.0"
7533-
hono: "npm:^4.7.0"
7534-
on-change: "npm:^5.0.1"
7535-
p-retry: "npm:^6.2.1"
7536-
zod: "npm:^3.24.1"
7537-
peerDependencies:
7538-
eventsource: ^3.0.5
7539-
ws: ^8.0.0
7540-
peerDependenciesMeta:
7541-
eventsource:
7542-
optional: true
7543-
ws:
7544-
optional: true
7545-
bin:
7546-
actor-core: ./dist/cli/mod.cjs
7547-
checksum: 10c0/4530252688961f39957cca6f6ac2edfd1a6a52f8dac0cc8cebff23a170084089fb56180e0041f2c458681d8033c3205aa4467f10c8da0c4297777153528dcebd
7489+
checksum: 10c0/7dbe3885982d29a4709cdeb019e18ca38ccbd256ad11a47c56240208ab3e0f9e18b92a551d42bbbd1efec24db12e0539f0ab1495049778c5da7ef8c18cd60c73
75487490
languageName: node
75497491
linkType: hard
75507492

@@ -13955,15 +13897,6 @@ __metadata:
1395513897
languageName: node
1395613898
linkType: hard
1395713899

13958-
"openapi3-ts@npm:^4.1.2":
13959-
version: 4.4.0
13960-
resolution: "openapi3-ts@npm:4.4.0"
13961-
dependencies:
13962-
yaml: "npm:^2.5.0"
13963-
checksum: 10c0/900b834279fc8a43c545728ad75ec7c26934ec5344225b60d1e1c0df44d742d7e7379aea18d9034e03031f079d3308ba5a68600682eece3ed41cdbdd10346a9e
13964-
languageName: node
13965-
linkType: hard
13966-
1396713900
"openid-client@npm:^6.5.0":
1396813901
version: 6.5.0
1396913902
resolution: "openid-client@npm:6.5.0"
@@ -18973,7 +18906,7 @@ __metadata:
1897318906
languageName: node
1897418907
linkType: hard
1897518908

18976-
"yaml@npm:^2.3.1, yaml@npm:^2.3.4, yaml@npm:^2.5.0":
18909+
"yaml@npm:^2.3.1, yaml@npm:^2.3.4":
1897718910
version: 2.8.0
1897818911
resolution: "yaml@npm:2.8.0"
1897918912
bin:

0 commit comments

Comments
 (0)