Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

[issue-880] Upgrade to React 19 + react-three fiber 9 / drei 10

Adam Eivy27254d6baf13
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index ea36e1a023..1d8fecfe7f 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -55,6 +55,7 @@
## Changed
+- **[issue-880] React 19 + react-three stack upgrade** — upgraded the web UI to React 19 (react / react-dom 18 → 19) and brought the 3D stack current: `@react-three/fiber` 8 → 9, `@react-three/drei` 9 → 10, and `three` 0.182 → 0.184. drei 10 hard-requires fiber 9 + React 19, so this is one coupled, app-wide bump rather than a drei-only update. `three` is now pinned to a single deduped instance across the dependency tree, which removes the dual-`three` mismatch that previously crashed the CyberCity canvas whenever a drei `<Line>` mounted. Internal maintenance change with no user-visible behavior difference.
- **[issue-760]** Standardized how the API reports errors so every failure now carries a consistent machine-readable code alongside its message — internal maintenance change with no user-visible behavior difference.
- **[issue-726]** Documented the storage layer's per-collection `config` slot convention so future features reuse a consistent shape — internal maintenance change with no behavior difference.
- **[issue-730] Groundwork for cross-machine Story Builder sessions** — Story Builder sessions stay private to one machine, but the staleness model that powers the "needs another look" warnings on locked steps is now sync-safe: when a session opts into cross-machine resume, those warnings follow a snapshot the session carries with it instead of re-checking the live world, so a change another of your machines makes to the same universe won't make every locked step look stale once the session can travel between machines. Internal foundation — the cross-machine sync itself lands in a follow-up.
diff --git a/client/package.json b/client/package.json
index ca2f0893e4..6754f3e049 100644
--- a/client/package.json
+++ b/client/package.json
@@ -16,18 +16,18 @@
"@dnd-kit/core": "6.3.1",
"@dnd-kit/sortable": "10.0.0",
"@dnd-kit/utilities": "3.2.2",
- "@react-three/drei": "9.122.0",
- "@react-three/fiber": "8.18.0",
+ "@react-three/drei": "10.7.7",
+ "@react-three/fiber": "9.6.1",
"@xterm/addon-fit": "0.11.0",
"@xterm/addon-web-links": "0.12.0",
"@xterm/xterm": "6.0.0",
"lucide-react": "0.562.0",
- "react": "18.3.1",
- "react-dom": "18.3.1",
+ "react": "19.2.7",
+ "react-dom": "19.2.7",
"react-router-dom": "7.5.2",
"recharts": "3.7.0",
"socket.io-client": "4.8.3",
- "three": "0.182.0"
+ "three": "0.184.0"
},
"devDependencies": {
"@eslint/js": "9.23.0",
@@ -50,6 +50,7 @@
"socket.io-parser": "4.2.6",
"minimatch@3": {
"brace-expansion": "1.1.12"
- }
+ },
+ "three": "0.184.0"
}
}
diff --git a/client/src/components/sync/SyncDetailDrawer.test.jsx b/client/src/components/sync/SyncDetailDrawer.test.jsx
index 97e1d618ec..58f6f8cf5a 100644
--- a/client/src/components/sync/SyncDetailDrawer.test.jsx
+++ b/client/src/components/sync/SyncDetailDrawer.test.jsx
@@ -228,7 +228,9 @@ describe('SyncDetailDrawer', () => {
it('shows collection thumbnails when collection is fetched', async () => {
mockGetMediaCollection.mockResolvedValue(COLLECTION_DATA);
render(<SyncDetailDrawer kind="mediaCollection" recordId={RECORD_ID} onClose={() => {}} />);
- await waitFor(() => expect(screen.getByText('My Collection')).toBeInTheDocument());
+ // The collection name renders both in the drawer header (<p>) and the
+ // preview card (<h3>), so scope the assertion to the preview heading.
+ await screen.findByRole('heading', { name: 'My Collection' });
expect(screen.getByText('2 items')).toBeInTheDocument();
const thumbs = screen.getAllByTestId('media-image');
expect(thumbs.length).toBeGreaterThan(0);
@@ -281,7 +283,7 @@ describe('SyncDetailDrawer', () => {
mockGetMediaCollection.mockResolvedValue(COLLECTION_DATA);
render(<SyncDetailDrawer kind="mediaCollection" recordId={RECORD_ID} onClose={() => {}} />);
// Wait for collection to load
- await waitFor(() => screen.getByText('My Collection'));
+ await screen.findByRole('heading', { name: 'My Collection' });
fireEvent.click(screen.getByRole('button', { name: /pull missing metadata/i }));
await waitFor(() => expect(mockPullMissingMetadata).toHaveBeenCalledWith(
['img1.png', 'img2.png'], { silent: true },
@@ -293,7 +295,7 @@ describe('SyncDetailDrawer', () => {
mockGetMediaCollection.mockResolvedValue(COLLECTION_DATA);
mockPullMissingMetadata.mockResolvedValue({ recovered: 1, attempted: 2 });
render(<SyncDetailDrawer kind="mediaCollection" recordId={RECORD_ID} onClose={() => {}} />);
- await waitFor(() => screen.getByText('My Collection'));
+ await screen.findByRole('heading', { name: 'My Collection' });
fireEvent.click(screen.getByRole('button', { name: /pull missing metadata/i }));
await waitFor(() => expect(mockToast.success).toHaveBeenCalledWith(expect.stringMatching(/pulled 1\/2/i)));
});
@@ -302,7 +304,7 @@ describe('SyncDetailDrawer', () => {
mockGetMediaCollection.mockResolvedValue(COLLECTION_DATA);
mockPullMissingMetadata.mockResolvedValue({ recovered: 0, attempted: 2 });
render(<SyncDetailDrawer kind="mediaCollection" recordId={RECORD_ID} onClose={() => {}} />);
- await waitFor(() => screen.getByText('My Collection'));
+ await screen.findByRole('heading', { name: 'My Collection' });
fireEvent.click(screen.getByRole('button', { name: /pull missing metadata/i }));
await waitFor(() => expect(mockToast).toHaveBeenCalledWith(expect.stringMatching(/no missing metadata found \(2 checked\)/i)));
expect(mockToast.success).not.toHaveBeenCalled();
@@ -365,7 +367,7 @@ describe('SyncDetailDrawer', () => {
it('fetches the collection only once (preview + pull share the same state)', async () => {
mockGetMediaCollection.mockResolvedValue(COLLECTION_DATA);
render(<SyncDetailDrawer kind="mediaCollection" recordId={RECORD_ID} onClose={() => {}} />);
- await waitFor(() => screen.getByText('My Collection'));
+ await screen.findByRole('heading', { name: 'My Collection' });
expect(mockGetMediaCollection).toHaveBeenCalledTimes(1);
// Clicking pull reads from the already-loaded state — must NOT re-fetch
// the collection before calling pullMissingMetadata.
diff --git a/client/src/hooks/useMediaAnnotations.test.jsx b/client/src/hooks/useMediaAnnotations.test.jsx
index 4a23d16ede..e2b0b8b9ae 100644
--- a/client/src/hooks/useMediaAnnotations.test.jsx
+++ b/client/src/hooks/useMediaAnnotations.test.jsx
@@ -26,6 +26,16 @@ import { useMediaAnnotations } from './useMediaAnnotations.js';
const emit = (payload) => act(() => { handlers.get('media:annotation:updated')(payload); });
+// Mount the hook, wait until it has subscribed to the socket, then flush the
+// mount fetch's setAnnotations commit so the initial enrichAll({}) can't land
+// mid-test and swap the annotations object reference under React 19.
+async function mountHook() {
+ const { result } = renderHook(() => useMediaAnnotations());
+ await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ await act(async () => {});
+ return result;
+}
+
describe('useMediaAnnotations — socket bail-out guard', () => {
beforeEach(() => {
handlers.clear();
@@ -38,8 +48,7 @@ describe('useMediaAnnotations — socket bail-out guard', () => {
});
it('applies a new entry from the socket broadcast', async () => {
- const { result } = renderHook(() => useMediaAnnotations());
- await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ const result = await mountHook();
emit({ key: 'a.png', entry: { own: { starred: true, note: '', updatedAt: '2026-01-01T00:00:00Z' } } });
@@ -47,8 +56,7 @@ describe('useMediaAnnotations — socket bail-out guard', () => {
});
it('returns the same annotations reference when an identical entry is rebroadcast', async () => {
- const { result } = renderHook(() => useMediaAnnotations());
- await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ const result = await mountHook();
const entry = { own: { starred: true, note: 'hi', updatedAt: '2026-01-01T00:00:00Z' } };
emit({ key: 'a.png', entry });
@@ -61,8 +69,7 @@ describe('useMediaAnnotations — socket bail-out guard', () => {
});
it('still re-renders when a field changes (e.g. a newer updatedAt)', async () => {
- const { result } = renderHook(() => useMediaAnnotations());
- await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ const result = await mountHook();
emit({ key: 'a.png', entry: { own: { starred: false, note: 'first', updatedAt: '2026-01-01T00:00:00Z' } } });
const first = result.current.annotations;
@@ -74,8 +81,7 @@ describe('useMediaAnnotations — socket bail-out guard', () => {
});
it('returns the same reference when deleting a key that was never present', async () => {
- const { result } = renderHook(() => useMediaAnnotations());
- await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ const result = await mountHook();
const before = result.current.annotations;
emit({ key: 'missing.png', entry: null });
@@ -84,8 +90,7 @@ describe('useMediaAnnotations — socket bail-out guard', () => {
});
it('removes an existing key when the broadcast clears it', async () => {
- const { result } = renderHook(() => useMediaAnnotations());
- await waitFor(() => expect(handlers.has('media:annotation:updated')).toBe(true));
+ const result = await mountHook();
emit({ key: 'a.png', entry: { own: { starred: true, note: '', updatedAt: '2026-01-01T00:00:00Z' } } });
expect(result.current.annotations['a.png']).toBeTruthy();
diff --git a/client/src/pages/StoryBuilder.test.jsx b/client/src/pages/StoryBuilder.test.jsx
index 9d1a3cbc1c..b983247bc9 100644
--- a/client/src/pages/StoryBuilder.test.jsx
+++ b/client/src/pages/StoryBuilder.test.jsx
@@ -453,6 +453,10 @@ describe('StoryBuilder — detail stepper', () => {
});
renderAt('/story-builder/stb-1/idea');
await waitFor(() => expect(screen.getByRole('heading', { name: 'Idea' })).toBeTruthy());
+ // The provider options load async (getProviders) — wait for the "Claude"
+ // option to render before selecting it, or the <select> has no matching
+ // option and resets the value to "".
+ await waitFor(() => expect(screen.getByRole('option', { name: 'Claude' })).toBeInTheDocument());
fireEvent.change(screen.getByLabelText('AI'), { target: { value: 'p1' } });
await waitFor(() => expect(api.updateStorySession).toHaveBeenCalledWith(
'stb-1', { llm: { provider: 'p1', model: null } }, expect.anything(),