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

fix: keep non-3D hook imports out of the render graph (#13247)

Adam Eivy920f8b3a3e3d
diff --git a/client/src/components/QuickBrainCapture.jsx b/client/src/components/QuickBrainCapture.jsx
index 7281bf502b..3734fbe93c 100644
--- a/client/src/components/QuickBrainCapture.jsx
+++ b/client/src/components/QuickBrainCapture.jsx
@@ -3,7 +3,9 @@ import { Link } from 'react-router';
import { ChevronDown, ClipboardPaste, Film, Send, Sliders, Sparkles, X } from 'lucide-react';
import toast from './ui/Toast';
import * as api from '../services/api';
-import { useLocalStorageBool, useRepoIntake, useYoutubeIngest } from '../hooks';
+import { useLocalStorageBool } from '../hooks/useLocalStorageBool.js';
+import { useRepoIntake } from '../hooks/useRepoIntake.js';
+import useYoutubeIngest from '../hooks/useYoutubeIngest.js';
import { parseBareUrl } from '../lib/bareUrl';
import { readClipboard } from '../lib/clipboard';
import { INGEST_OPTIONS, defaultIngestOptions, ingestOptionsFromSettings, isYoutubeVideoUrl } from '../lib/youtubeUrl';
diff --git a/client/src/components/apps/SlashDoPanel.jsx b/client/src/components/apps/SlashDoPanel.jsx
index bf591991ea..45a598859e 100644
--- a/client/src/components/apps/SlashDoPanel.jsx
+++ b/client/src/components/apps/SlashDoPanel.jsx
@@ -5,7 +5,7 @@ import toast from '../ui/Toast';
import { NON_PM2_TYPES } from './constants';
import { slashdoLabel, slashdoWorkflowsForApp } from '../../lib/slashdoCatalog';
import ProviderModelSelector from '../ProviderModelSelector';
-import { useRunWithPicker } from '../../hooks';
+import useRunWithPicker from '../../hooks/useRunWithPicker.js';
import SlashDoRunDrawer from './SlashDoRunDrawer';
import * as api from '../../services/api';
diff --git a/client/src/components/brain/RepoRestudyPanel.jsx b/client/src/components/brain/RepoRestudyPanel.jsx
index 8c7a6b85f7..5e9ed8b4a1 100644
--- a/client/src/components/brain/RepoRestudyPanel.jsx
+++ b/client/src/components/brain/RepoRestudyPanel.jsx
@@ -4,7 +4,8 @@ import * as api from '../../services/api';
import toast from '../ui/Toast';
import BrailleSpinner from '../BrailleSpinner';
import RepoStudyFields from './RepoStudyFields';
-import { useAsyncAction, useRepoStudyConfig } from '../../hooks';
+import { useAsyncAction } from '../../hooks/useAsyncAction.js';
+import { useRepoStudyConfig } from '../../hooks/useRepoStudyConfig.js';
/**
* The Links tab's on-demand "Update & study" form for an already-cloned repo:
diff --git a/client/src/components/brain/tabs/BrainCollectionPagination.test.jsx b/client/src/components/brain/tabs/BrainCollectionPagination.test.jsx
index 2e457bbaa1..48dc62f041 100644
--- a/client/src/components/brain/tabs/BrainCollectionPagination.test.jsx
+++ b/client/src/components/brain/tabs/BrainCollectionPagination.test.jsx
@@ -41,8 +41,10 @@ vi.mock('../../../services/api', () => api);
vi.mock('../../../services/apiBrain', () => api);
vi.mock('../../../services/socket', () => ({ default: mockSocket }));
-vi.mock('../../../hooks', () => ({
+vi.mock('../../../hooks/useLocalStorageBool.js', () => ({
useLocalStorageBool: () => [false, vi.fn()],
+}));
+vi.mock('../../../hooks/useRepoIntake.js', () => ({
useRepoIntake: () => ({
repo: null,
options: { malwareScan: false, learn: false },
diff --git a/client/src/components/brain/tabs/InboxTab.jsx b/client/src/components/brain/tabs/InboxTab.jsx
index df3a9c425a..73688e5b5b 100644
--- a/client/src/components/brain/tabs/InboxTab.jsx
+++ b/client/src/components/brain/tabs/InboxTab.jsx
@@ -23,7 +23,7 @@ import BrailleSpinner from '../../BrailleSpinner';
import toast from '../../ui/Toast';
import InlineConfirmRow from '../../ui/InlineConfirmRow';
import InfiniteScrollFooter from '../../ui/InfiniteScrollFooter';
-import { useLocalStorageBool } from '../../../hooks';
+import { useLocalStorageBool } from '../../../hooks/useLocalStorageBool.js';
import { useFailedCaptures } from '../../../hooks/useFailedCaptures';
import FailedCaptureList from '../FailedCaptureList';
import { usePagedCollection } from '../../../hooks/usePagedCollection';
@@ -38,7 +38,7 @@ import { timeAgo } from '../../../utils/formatters';
import { parseBareUrl } from '../../../lib/bareUrl';
import VoiceCapture from '../VoiceCapture';
import RepoIntakeOptions from '../RepoIntakeOptions';
-import { useRepoIntake } from '../../../hooks';
+import { useRepoIntake } from '../../../hooks/useRepoIntake.js';
// Where a filed entry's "View" button points. A bare-URL capture is filed to the
// links collection (see captureUrlAsLink) and lives in the Links tab; every
diff --git a/client/src/components/brain/tabs/InboxTab.test.jsx b/client/src/components/brain/tabs/InboxTab.test.jsx
index 9b41f3120f..880c8c4706 100644
--- a/client/src/components/brain/tabs/InboxTab.test.jsx
+++ b/client/src/components/brain/tabs/InboxTab.test.jsx
@@ -17,8 +17,10 @@ vi.mock('../../../services/socket', () => ({
default: { on: vi.fn(), off: vi.fn() },
}));
-vi.mock('../../../hooks', () => ({
+vi.mock('../../../hooks/useLocalStorageBool.js', () => ({
useLocalStorageBool: () => [false, vi.fn()],
+}));
+vi.mock('../../../hooks/useRepoIntake.js', () => ({
useRepoIntake: () => ({
repo: null,
options: { malwareScan: false, learn: false },
diff --git a/client/src/components/brain/tabs/YoutubeTab.jsx b/client/src/components/brain/tabs/YoutubeTab.jsx
index 9d25584e05..612e395a6a 100644
--- a/client/src/components/brain/tabs/YoutubeTab.jsx
+++ b/client/src/components/brain/tabs/YoutubeTab.jsx
@@ -6,7 +6,7 @@ import FormField from '../../ui/FormField';
import BrailleSpinner from '../../BrailleSpinner';
import { formatDateTime } from '../../../utils/formatters';
import { useSyncSourceSettings } from '../../../hooks/useSyncSourceSettings';
-import { useVideoDownload } from '../../../hooks';
+import useVideoDownload from '../../../hooks/useVideoDownload.js';
import {
getYoutubeStatus,
getYoutubeSetupCheck,
diff --git a/client/src/components/brain/tabs/YoutubeTab.test.jsx b/client/src/components/brain/tabs/YoutubeTab.test.jsx
index 504b5444d1..62da3fa058 100644
--- a/client/src/components/brain/tabs/YoutubeTab.test.jsx
+++ b/client/src/components/brain/tabs/YoutubeTab.test.jsx
@@ -17,8 +17,8 @@ vi.mock('../../../hooks/useSyncSourceSettings', () => ({
setIntervalMinutes: vi.fn(), saving: false, status: null, setStatus: vi.fn(), dirty: false, save: vi.fn(),
}),
}));
-vi.mock('../../../hooks', () => ({
- useVideoDownload: () => ({ active: false, percent: 0, stage: null, context: null, start: vi.fn(), cancel: vi.fn() }),
+vi.mock('../../../hooks/useVideoDownload.js', () => ({
+ default: () => ({ active: false, percent: 0, stage: null, context: null, start: vi.fn(), cancel: vi.fn() }),
}));
import { YoutubeTab } from './YoutubeTab';
diff --git a/client/src/components/video/YtDlpUpdateCard.jsx b/client/src/components/video/YtDlpUpdateCard.jsx
index 6a984650e4..ce1b67016b 100644
--- a/client/src/components/video/YtDlpUpdateCard.jsx
+++ b/client/src/components/video/YtDlpUpdateCard.jsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { AlertTriangle, CheckCircle2, Loader2, RefreshCw } from 'lucide-react';
import toast from '../ui/Toast';
-import { useSocket } from '../../hooks';
+import { useSocket } from '../../hooks/useSocket.js';
import { getYtDlpStatus, updateYtDlp } from '../../services/apiVideoDownload.js';
/**
diff --git a/client/src/components/video/YtDlpUpdateCard.test.jsx b/client/src/components/video/YtDlpUpdateCard.test.jsx
index 4923d713f2..6039d02df1 100644
--- a/client/src/components/video/YtDlpUpdateCard.test.jsx
+++ b/client/src/components/video/YtDlpUpdateCard.test.jsx
@@ -10,7 +10,7 @@ vi.mock('../../services/apiVideoDownload.js', () => ({
vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), error: vi.fn() } }));
const handlers = new Map();
-vi.mock('../../hooks', () => ({
+vi.mock('../../hooks/useSocket.js', () => ({
useSocket: () => ({
on: (event, fn) => handlers.set(event, fn),
off: (event) => handlers.delete(event),
diff --git a/client/src/hooks/index.test.js b/client/src/hooks/index.test.js
index 8487ff44da..a3787ab868 100644
--- a/client/src/hooks/index.test.js
+++ b/client/src/hooks/index.test.js
@@ -1,11 +1,14 @@
// @vitest-environment node
-import { describe, it, expect } from 'vitest';
+import { describe, it, expect, vi } from 'vitest';
import { readdirSync, readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import * as barrel from './index.js';
+// Enumeration never renders a GLTF; keep Drei's render-only dependency out of this harness.
+vi.mock('@react-three/drei', () => ({ useAnimations: vi.fn(), useGLTF: vi.fn() }));
+
const HERE = dirname(fileURLToPath(import.meta.url));
const BARREL_SRC = readFileSync(join(HERE, 'index.js'), 'utf8');
const README_SRC = readFileSync(join(HERE, 'README.md'), 'utf8');
diff --git a/client/src/pages/VideoDownloaderPage.jsx b/client/src/pages/VideoDownloaderPage.jsx
index 68ac067f8f..36000c6d5d 100644
--- a/client/src/pages/VideoDownloaderPage.jsx
+++ b/client/src/pages/VideoDownloaderPage.jsx
@@ -6,7 +6,8 @@ import ListLoadError from '../components/ui/ListLoadError';
import toast from '../components/ui/Toast';
import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';
import YtDlpUpdateCard from '../components/video/YtDlpUpdateCard';
-import { useVideoDownload, useConfirmDelete } from '../hooks';
+import useVideoDownload from '../hooks/useVideoDownload.js';
+import useConfirmDelete from '../hooks/useConfirmDelete.js';
import useListResource from '../hooks/useListResource';
import { listVideoDownloads, deleteVideoDownload } from '../services/apiVideoDownload.js';
import { timeAgo, formatTimecode } from '../utils/formatters';
diff --git a/client/src/pages/VideoDownloaderPage.test.jsx b/client/src/pages/VideoDownloaderPage.test.jsx
index e28e5d3403..a632bae112 100644
--- a/client/src/pages/VideoDownloaderPage.test.jsx
+++ b/client/src/pages/VideoDownloaderPage.test.jsx
@@ -8,9 +8,11 @@ vi.mock('../services/apiVideoDownload.js', () => ({
]),
deleteVideoDownload: vi.fn(),
}));
-vi.mock('../hooks', () => ({
- useVideoDownload: () => ({ active: false, percent: 0, stage: '', start: vi.fn(), cancel: vi.fn() }),
- useConfirmDelete: () => ({ isConfirming: () => false, requestDelete: vi.fn(), cancelDelete: vi.fn(), confirmDelete: vi.fn() }),
+vi.mock('../hooks/useVideoDownload.js', () => ({
+ default: () => ({ active: false, percent: 0, stage: '', start: vi.fn(), cancel: vi.fn() }),
+}));
+vi.mock('../hooks/useConfirmDelete.js', () => ({
+ default: () => ({ isConfirming: () => false, requestDelete: vi.fn(), cancelDelete: vi.fn(), confirmDelete: vi.fn() }),
}));
vi.mock('../components/video/YtDlpUpdateCard', () => ({ default: () => null }));
vi.mock('../components/ui/Toast', () => ({ default: { error: vi.fn(), success: vi.fn() } }));
diff --git a/client/src/pages/VoiceCallHost.jsx b/client/src/pages/VoiceCallHost.jsx
index c01facb40b..6c2195318c 100644
--- a/client/src/pages/VoiceCallHost.jsx
+++ b/client/src/pages/VoiceCallHost.jsx
@@ -22,7 +22,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { Mic, MicOff, PhoneCall, Radio, Volume2 } from 'lucide-react';
import socket from '../services/socket';
import TabPills from '../components/ui/TabPills';
-import { useDrawerTab } from '../hooks';
+import useDrawerTab from '../hooks/useDrawerTab.js';
import {
CALL_FRAME_SAMPLES,
CALL_HOST_LOCK,