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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: say when mail, vaults, history, or Get Stuff Done projects failed to load instead of showing an empty list (#10279)
Adam Eivy582c41b02538
diff --git a/client/src/components/cos/tabs/GsdTab.jsx b/client/src/components/cos/tabs/GsdTab.jsxindex 7e6b96f56e..000eb42b73 100644--- a/client/src/components/cos/tabs/GsdTab.jsx+++ b/client/src/components/cos/tabs/GsdTab.jsx@@ -2,16 +2,19 @@ import { useState, useEffect, useCallback } from 'react';import { RefreshCw, Compass } from 'lucide-react';import toast from '../../ui/Toast';import * as api from '../../../services/api';+import LoadFailedState from '../../ui/LoadFailedState';import GsdProjectCard from './GsdProjectCard';export default function GsdTab() {const [projects, setProjects] = useState([]);const [loading, setLoading] = useState(true);+ const [failed, setFailed] = useState(false);const [refreshing, setRefreshing] = useState(false);const fetchData = useCallback(async () => {- const projectsData = await api.getGsdProjects().catch(() => ({ projects: [] }));- setProjects(projectsData.projects || projectsData || []);+ const projectsData = await api.getGsdProjects().catch(() => null);+ setFailed(projectsData === null);+ if (projectsData) setProjects(projectsData.projects || projectsData || []);setLoading(false);}, []);@@ -27,7 +30,7 @@ export default function GsdTab() {};if (loading) {- return <p className="text-sm text-gray-500">Loading GSD projects...</p>;+ return <p className="text-sm text-gray-500">Loading Get Stuff Done projects...</p>;}return (@@ -36,7 +39,7 @@ export default function GsdTab() {<div className="flex items-center justify-between"><div className="flex items-center gap-2"><Compass size={18} className="text-port-accent" />- <h2 className="text-lg font-semibold text-white">GSD Projects</h2>+ <h2 className="text-lg font-semibold text-white">Get Stuff Done projects</h2><span className="text-xs text-gray-500">({projects.length})</span></div><button@@ -55,10 +58,12 @@ export default function GsdTab() {</p>{/* Project Cards */}- {projects.length === 0 ? (+ {failed && projects.length === 0 ? (+ <LoadFailedState title="Could not load Get Stuff Done projects." hint="Retry." onRetry={fetchData} />+ ) : projects.length === 0 ? (<div className="text-center py-12 text-gray-500"><Compass size={48} className="mx-auto mb-3 opacity-30" />- <p className="text-sm">No GSD-enabled projects found</p>+ <p className="text-sm">No Get Stuff Done projects found</p><p className="text-xs mt-1">Apps with a <code className="text-port-accent">.planning/</code> directory will appear here</p></div>) : (diff --git a/client/src/components/cos/tabs/GsdTab.test.jsx b/client/src/components/cos/tabs/GsdTab.test.jsxnew file mode 100644index 0000000000..8e121688dc--- /dev/null+++ b/client/src/components/cos/tabs/GsdTab.test.jsx@@ -0,0 +1,26 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { fireEvent, render, screen } from '@testing-library/react';++const api = vi.hoisted(() => ({ getGsdProjects: vi.fn() }));+vi.mock('../../../services/api', () => api);+vi.mock('../../ui/Toast', () => ({ default: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn() }) }));+vi.mock('./GsdProjectCard', () => ({ default: ({ project }) => <div>{project.appId}</div> }));++const GsdTab = (await import('./GsdTab')).default;++describe('GsdTab load failure (#10279)', () => {+ beforeEach(() => vi.clearAllMocks());++ it('says the load failed rather than claiming no projects, and retries', async () => {+ api.getGsdProjects.mockRejectedValueOnce(new Error('offline'));+ api.getGsdProjects.mockResolvedValueOnce({ projects: [] });+ render(<GsdTab />);++ expect(await screen.findByText('Could not load Get Stuff Done projects.')).toBeInTheDocument();+ expect(screen.queryByText('No Get Stuff Done projects found')).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ expect(await screen.findByText('No Get Stuff Done projects found')).toBeInTheDocument();+ expect(screen.getByRole('heading', { name: 'Get Stuff Done projects' })).toBeInTheDocument();+ });+});diff --git a/client/src/components/messages/InboxTab.jsx b/client/src/components/messages/InboxTab.jsxindex c6ab46225c..22f0033ea4 100644--- a/client/src/components/messages/InboxTab.jsx+++ b/client/src/components/messages/InboxTab.jsx@@ -9,6 +9,7 @@ import { timeAgo, formatDateNumeric } from '../../utils/formatters';import MessageDetail from './MessageDetail';import AddToThreadButton from '../threads/AddToThreadButton';import { messageReadState, partitionAccountsBySyncMode } from '../../lib/messageSyncModes';+import LoadFailedState from '../ui/LoadFailedState';const ACTION_CONFIG = {reply: { icon: Reply, color: 'text-port-accent', bg: 'bg-port-accent/10', hoverBg: 'hover:bg-port-accent/20', label: 'Reply' },@@ -178,6 +179,7 @@ export default function InboxTab({ accounts }) {const accountList = useMemo(() => accounts || [], [accounts]);const [messages, setMessages] = useState([]);const [loading, setLoading] = useState(true);+ const [loadFailed, setLoadFailed] = useState(false);const [search, setSearch] = useState('');const [debouncedSearch, setDebouncedSearch] = useState('');const [selectedAccount, setSelectedAccount] = useState('');@@ -231,8 +233,9 @@ export default function InboxTab({ accounts }) {const params = { summary: true };if (selectedAccount) params.accountId = selectedAccount;if (debouncedSearch) params.search = debouncedSearch;- const result = await api.getMessageInbox(params, { silent: true }).catch(() => ({ messages: [], total: 0 }));- setMessages(result.messages || []);+ const result = await api.getMessageInbox(params, { silent: true }).catch(() => null);+ setLoadFailed(result === null);+ if (result) setMessages(result.messages || []);setLoading(false);}, [selectedAccount, debouncedSearch]);@@ -562,7 +565,15 @@ export default function InboxTab({ accounts }) {className="-mx-1 px-1"/>- {visibleMessages.length === 0 && !loading && (+ {loadFailed && !loading && (+ <LoadFailedState+ title="Could not load messages."+ hint="Retry. An empty inbox is shown only after the list loads."+ onRetry={fetchMessages}+ />+ )}++ {visibleMessages.length === 0 && !loading && !loadFailed && (<InboxEmptyStateaccounts={accounts}lastSyncAt={lastSyncAt}diff --git a/client/src/components/messages/InboxTab.test.jsx b/client/src/components/messages/InboxTab.test.jsxindex b17b428c37..f7188b271c 100644--- a/client/src/components/messages/InboxTab.test.jsx+++ b/client/src/components/messages/InboxTab.test.jsx@@ -189,6 +189,18 @@ describe('InboxTab empty state', () => {fireEvent.click(screen.getByRole('button', { name: /open config/i }));expect(await screen.findByText('CONFIG SCREEN')).toBeInTheDocument();});++ it('says the message list failed to load instead of claiming an empty inbox (#10279)', async () => {+ api.getMessageInbox.mockRejectedValueOnce(new Error('offline'));+ renderInbox([syncedAccount]);++ expect(await screen.findByText('Could not load messages.')).toBeInTheDocument();+ expect(screen.queryByText('Your inbox is empty')).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ expect(await screen.findByText('Your inbox is empty')).toBeInTheDocument();+ expect(screen.queryByText('Could not load messages.')).not.toBeInTheDocument();+ });});describe('InboxTab sync capability (#9968)', () => {diff --git a/client/src/components/ui/LoadFailedState.jsx b/client/src/components/ui/LoadFailedState.jsxnew file mode 100644index 0000000000..626301025b--- /dev/null+++ b/client/src/components/ui/LoadFailedState.jsx@@ -0,0 +1,22 @@+import { AlertTriangle } from 'lucide-react';++/**+ * A failed read is not an empty list. Render this in place of the+ * "nothing here" sentence when the load rejected, with a retry control.+ */+export default function LoadFailedState({ title, hint, onRetry }) {+ return (+ <div role="alert" className="flex flex-col items-center text-center py-12 px-4 text-gray-400">+ <AlertTriangle size={40} className="mb-3 text-port-error opacity-70" />+ <p className="text-sm font-medium text-port-error">{title}</p>+ {hint && <p className="text-xs mt-1 text-gray-500">{hint}</p>}+ <button+ type="button"+ onClick={onRetry}+ className="mt-3 min-h-[40px] rounded bg-port-card border border-port-border px-3 text-xs text-port-accent hover:text-white"+ >+ Retry+ </button>+ </div>+ );+}diff --git a/client/src/components/ui/README.md b/client/src/components/ui/README.mdindex 094a3c701e..e239197268 100644--- a/client/src/components/ui/README.md+++ b/client/src/components/ui/README.md@@ -26,6 +26,7 @@ accessibility). Feature-specific components live under their own feature directo| `InfoTooltip` | Focusable info/help tooltip — hover, keyboard focus, or tap; opaque body portal with viewport-clamped numeric `width` (default 224), start/center/end alignment, keyboard scrolling, and Esc dismissal. || `InlineConfirmRow` | Inline "question + confirm + cancel" row — PortOS's preferred alternative to `window.confirm`. || `InlineDiff` | Stacked word-level diff — old row (red removals) over new row (green additions). |+| `LoadFailedState` | Alert shown when a read failed (title, hint, Retry) so a failed load never renders as an empty-list sentence. || `Kbd` | Keycap for rendering a keyboard key in help/cheatsheet UI. || `Modal` | Shared modal chrome — backdrop, Esc handling, click-outside. || `OverflowMenu` | "…" menu that demotes rare or destructive row actions out of the visible control set. |diff --git a/client/src/pages/HistoryPage.jsx b/client/src/pages/HistoryPage.jsxindex 2151d8b9e6..585ff98cf6 100644--- a/client/src/pages/HistoryPage.jsx+++ b/client/src/pages/HistoryPage.jsx@@ -3,6 +3,7 @@ import { Trash2 } from 'lucide-react';import * as api from '../services/api';import { formatTime, formatRuntime, formatDateTime } from '../utils/formatters';import PageSkeleton from '../components/ui/PageSkeleton';+import LoadFailedState from '../components/ui/LoadFailedState';import Banner from '../components/ui/Banner';import { clickableProps, onActivateKeyDown } from '../lib/a11yKeyboard.js';@@ -10,6 +11,7 @@ export function HistoryPage() {const [history, setHistory] = useState([]);const [stats, setStats] = useState(null);const [loading, setLoading] = useState(true);+ const [historyFailed, setHistoryFailed] = useState(false);const [filter, setFilter] = useState({ action: '', success: '' });const [actions, setActions] = useState([]);const [confirmingClear, setConfirmingClear] = useState(false);@@ -22,11 +24,12 @@ export function HistoryPage() {limit: 100,action: filter.action || undefined,success: filter.success !== '' ? filter.success === 'true' : undefined- }).catch(() => ({ entries: [] })),+ }).catch(() => null),api.getHistoryStats().catch(() => null),api.getHistoryActions().catch(() => [])]);- setHistory(historyData.entries || []);+ setHistoryFailed(historyData === null);+ if (historyData) setHistory(historyData.entries || []);setStats(statsData);setActions(actionsData);setLoading(false);@@ -163,7 +166,9 @@ export function HistoryPage() {{/* History List */}<div className="bg-port-card border border-port-border rounded-xl overflow-hidden">- {history.length === 0 ? (+ {historyFailed ? (+ <LoadFailedState title="Could not load history." hint="Retry." onRetry={loadData} />+ ) : history.length === 0 ? (<div className="text-center py-12 text-gray-500">No history entries</div>) : (<div className="divide-y divide-port-border">diff --git a/client/src/pages/Wiki.jsx b/client/src/pages/Wiki.jsxindex 23383eed91..5d32172366 100644--- a/client/src/pages/Wiki.jsx+++ b/client/src/pages/Wiki.jsx@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useMemo, useRef } from 'react';import { useParams, useNavigate, useSearchParams } from 'react-router';import * as api from '../services/api';import { BookOpen, Search, Network, FileText, BarChart3, Activity } from 'lucide-react';+import LoadFailedState from '../components/ui/LoadFailedState';import PageSkeleton from '../components/ui/PageSkeleton';import PageHeader from '../components/PageHeader';import TabPills from '../components/ui/TabPills';@@ -38,14 +39,16 @@ export default function Wiki() {const vaultParam = searchParams.get('vault');const [vaults, setVaults] = useState([]);+ const [vaultsFailed, setVaultsFailed] = useState(false);const [loading, setLoading] = useState(true);const [noteSnapshot, setNoteSnapshot] = useState(null);const mountedRef = useMounted();const scanSequence = useRef(0);const loadVaults = useCallback(async () => {- const data = await api.getNotesVaults().catch(() => []);- setVaults(data);+ const data = await api.getNotesVaults({ silent: true }).catch(() => null);+ setVaultsFailed(data === null);+ if (data) setVaults(data);setLoading(false);}, []);@@ -142,6 +145,16 @@ export default function Wiki() {);}+ if (vaultsFailed && vaults.length === 0) {+ return (+ <LoadFailedState+ title="Could not load Obsidian vaults."+ hint="Retry. This does not mean no vault is connected."+ onRetry={loadVaults}+ />+ );+ }+if (vaults.length === 0) {return (<div className="flex flex-col items-center justify-center h-full text-gray-500">diff --git a/client/src/pages/Wiki.test.jsx b/client/src/pages/Wiki.test.jsxindex 5e6d6247ab..44ed8bb89b 100644--- a/client/src/pages/Wiki.test.jsx+++ b/client/src/pages/Wiki.test.jsx@@ -223,3 +223,17 @@ describe('Wiki vault URL wiring', () => {await waitFor(() => expect(screen.getByTestId('overview')).toHaveTextContent('overview:vault-a'));});});++describe('Wiki vault load failure (#10279)', () => {+ it('does not claim no vault is connected when the vault list fails, and retries', async () => {+ getNotesVaults.mockRejectedValueOnce(new Error('offline'));+ renderWiki('/wiki/overview');++ expect(await screen.findByText('Could not load Obsidian vaults.')).toBeInTheDocument();+ expect(screen.queryByText('No Obsidian vaults connected')).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(screen.queryByText('Could not load Obsidian vaults.')).not.toBeInTheDocument());+ expect(getNotesVaults).toHaveBeenCalledTimes(2);+ });+});