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: stop JIRA config and Sharing inbox/activity collapsing failed reads to empty (#12790)

[._.]/ Adam Eivy274cfab0b289
diff --git a/client/src/components/apps/JiraConfigPanel.jsx b/client/src/components/apps/JiraConfigPanel.jsx
index 6b2ca71a43..a8d3ec90cd 100644
--- a/client/src/components/apps/JiraConfigPanel.jsx
+++ b/client/src/components/apps/JiraConfigPanel.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useMemo } from 'react';
+import { useState, useEffect, useMemo, useCallback } from 'react';
import { Link } from 'react-router';
import { Save, Loader2 } from 'lucide-react';
import * as api from '../../services/api';
@@ -12,6 +12,8 @@ import { INPUT_CLASS } from './constants';
// from "user is searching an epic by name" in the epic field.
const EPIC_KEY_RE = /^[A-Za-z][A-Za-z0-9]*-\d+$/;
+const EMPTY = Object.freeze([]);
+
const fetchJiraInstances = () => api.getJiraInstances({ silent: true })
.then(data => (data?.instances ? Object.values(data.instances) : []));
@@ -43,31 +45,39 @@ export default function JiraConfigPanel({ app, onSaved }) {
const [saving, setSaving] = useState(false);
const [error, setError] = useState(null);
const { items: instances, state: instancesState, error: instancesError, retry: retryInstances } = useListResource(fetchJiraInstances);
- const [projects, setProjects] = useState([]);
- const [loadingProjects, setLoadingProjects] = useState(false);
+ // Keyed reads: a failed one renders an error row + Retry, never "no projects" /
+ // "no boards" / "no active sprint". Items are ignored while the key is unset.
+ const fetchProjects = useCallback(
+ () => api.getJiraProjects(form.instanceId, { silent: true }),
+ [form.instanceId]
+ );
+ const { items: projectItems, state: projectsState, error: projectsError, retry: retryProjects } =
+ useListResource(fetchProjects, { enabled: !!form.instanceId });
+ const projects = form.instanceId ? projectItems : EMPTY;
+ const loadingProjects = !!form.instanceId && projectsState === 'loading';
const [projectSearch, setProjectSearch] = useState('');
const [projectDropdownOpen, setProjectDropdownOpen] = useState(false);
- const [boards, setBoards] = useState([]);
- const [loadingBoards, setLoadingBoards] = useState(false);
- const [boardSprints, setBoardSprints] = useState([]);
+ const fetchBoards = useCallback(
+ () => api.getJiraBoards(form.instanceId, form.projectKey, { silent: true }),
+ [form.instanceId, form.projectKey]
+ );
+ const boardsEnabled = !!form.instanceId && !!form.projectKey;
+ const { items: boardItems, state: boardsState, error: boardsError, retry: retryBoards } =
+ useListResource(fetchBoards, { enabled: boardsEnabled });
+ const boards = boardsEnabled ? boardItems : EMPTY;
+ const loadingBoards = boardsEnabled && boardsState === 'loading';
+ const fetchSprints = useCallback(
+ () => api.getJiraBoardSprints(form.instanceId, form.boardId, { silent: true }),
+ [form.instanceId, form.boardId]
+ );
+ const sprintsEnabled = !!form.instanceId && !!form.boardId;
+ const { items: sprintItems, state: sprintsState, error: sprintsError, retry: retrySprints } =
+ useListResource(fetchSprints, { enabled: sprintsEnabled });
+ const boardSprints = sprintsEnabled ? sprintItems : EMPTY;
const [epicResults, setEpicResults] = useState([]);
const [epicDropdownOpen, setEpicDropdownOpen] = useState(false);
const [epicValidation, setEpicValidation] = useState({ state: 'idle' });
- useEffect(() => {
- if (!form.instanceId) {
- setProjects([]);
- return;
- }
- let cancelled = false;
- setLoadingProjects(true);
- api.getJiraProjects(form.instanceId)
- .then(list => { if (!cancelled) setProjects(list || []); })
- .catch(() => { if (!cancelled) setProjects([]); })
- .finally(() => { if (!cancelled) setLoadingProjects(false); });
- return () => { cancelled = true; };
- }, [form.instanceId]);
-
// Default the assignee to the instance's own account so the common case needs
// no typing — only when the field is still empty, never overwriting a choice.
useEffect(() => {
@@ -76,35 +86,6 @@ export default function JiraConfigPanel({ app, onSaved }) {
if (inst?.email) setForm(prev => ({ ...prev, assignee: inst.email }));
}, [form.instanceId, form.assignee, instances]);
- // Detect the project's agile boards so the boardId is picked from live data
- // instead of hand-typed (which is how a boardId goes stale across a migration).
- useEffect(() => {
- if (!form.instanceId || !form.projectKey) {
- setBoards([]);
- return;
- }
- let cancelled = false;
- setLoadingBoards(true);
- api.getJiraBoards(form.instanceId, form.projectKey, { silent: true })
- .then(list => { if (!cancelled) setBoards(list || []); })
- .catch(() => { if (!cancelled) setBoards([]); })
- .finally(() => { if (!cancelled) setLoadingBoards(false); });
- return () => { cancelled = true; };
- }, [form.instanceId, form.projectKey]);
-
- // Show the selected board's active sprint as confirmation it's the right board.
- useEffect(() => {
- if (!form.instanceId || !form.boardId) {
- setBoardSprints([]);
- return;
- }
- let cancelled = false;
- api.getJiraBoardSprints(form.instanceId, form.boardId, { silent: true })
- .then(sprints => { if (!cancelled) setBoardSprints(sprints || []); })
- .catch(() => { if (!cancelled) setBoardSprints([]); });
- return () => { cancelled = true; };
- }, [form.instanceId, form.boardId]);
-
// Validate the configured epic key still resolves as an Epic on this instance.
useEffect(() => {
const key = form.epicKey.trim();
@@ -309,14 +290,19 @@ export default function JiraConfigPanel({ app, onSaved }) {
)}
</div>
) : (
- <input
- id="app-jira-project"
- type="text"
- value={form.projectKey}
- onChange={e => setForm({ ...form, projectKey: e.target.value })}
- className={INPUT_CLASS}
- placeholder="e.g. PROJ"
- />
+ <>
+ {projectsState === 'error' && (
+ <ListLoadError what="JIRA projects" error={projectsError} onRetry={retryProjects} className="mb-2" />
+ )}
+ <input
+ id="app-jira-project"
+ type="text"
+ value={form.projectKey}
+ onChange={e => setForm({ ...form, projectKey: e.target.value })}
+ className={INPUT_CLASS}
+ placeholder="e.g. PROJ"
+ />
+ </>
)}
</div>
@@ -345,13 +331,20 @@ export default function JiraConfigPanel({ app, onSaved }) {
{boardIsStale ? (
<p className="text-xs text-port-warning mt-1">⚠ Saved board {form.boardId} isn&apos;t among this project&apos;s boards — pick a current one.</p>
) : form.boardId && (
- <p className="text-xs text-gray-500 mt-1">
- {activeSprint ? `Active sprint: ${activeSprint.name}` : 'No active sprint on this board.'}
- </p>
+ sprintsState === 'error' ? (
+ <ListLoadError what="the board's sprints" error={sprintsError} onRetry={retrySprints} className="mt-1" />
+ ) : sprintsState === 'ready' && (
+ <p className="text-xs text-gray-500 mt-1">
+ {activeSprint ? `Active sprint: ${activeSprint.name}` : 'No active sprint on this board.'}
+ </p>
+ )
)}
</>
) : (
<>
+ {boardsState === 'error' && (
+ <ListLoadError what="JIRA boards" error={boardsError} onRetry={retryBoards} className="mb-2" />
+ )}
<input
id="app-jira-board"
type="text"
@@ -360,7 +353,7 @@ export default function JiraConfigPanel({ app, onSaved }) {
className={INPUT_CLASS}
placeholder="e.g. 1294 (from JIRA board URL rapidView param)"
/>
- <p className="text-xs text-gray-500 mt-1">Couldn&apos;t auto-detect boards — enter the id manually (board URL <span className="font-mono">rapidView</span> param).</p>
+ {boardsState === 'ready' && <p className="text-xs text-gray-500 mt-1">Couldn&apos;t auto-detect boards — enter the id manually (board URL <span className="font-mono">rapidView</span> param).</p>}
</>
)}
</div>
diff --git a/client/src/components/apps/JiraConfigPanel.test.jsx b/client/src/components/apps/JiraConfigPanel.test.jsx
index 6b904e36e4..1cf15e4fa0 100644
--- a/client/src/components/apps/JiraConfigPanel.test.jsx
+++ b/client/src/components/apps/JiraConfigPanel.test.jsx
@@ -43,4 +43,52 @@ describe('JiraConfigPanel', () => {
expect(await screen.findByText(/No JIRA instances configured/)).toBeInTheDocument();
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
});
+
+ describe('with an instance selected', () => {
+ const instance = { instances: { i1: { id: 'i1', name: 'Example', baseUrl: 'https://jira.example.com' } } };
+ const savedApp = (jira) => ({ id: 'app-1', jira: { enabled: true, instanceId: 'i1', ...jira } });
+ const renderApp = (jira) => render(<MemoryRouter><JiraConfigPanel app={savedApp(jira)} onSaved={() => {}} /></MemoryRouter>);
+
+ beforeEach(() => {
+ api.getJiraInstances.mockResolvedValue(instance);
+ api.getJiraBoards.mockResolvedValue([]);
+ api.getJiraBoardSprints.mockResolvedValue([]);
+ });
+
+ it('reports a failed projects read with Retry instead of silently offering a free-text key', async () => {
+ api.getJiraProjects.mockRejectedValueOnce(new Error('projects 500'));
+ renderApp({});
+
+ expect(await screen.findByRole('alert')).toHaveTextContent('Could not load JIRA projects — projects 500');
+ api.getJiraProjects.mockResolvedValue([{ key: 'PROJ', name: 'Project' }]);
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByPlaceholderText('Search projects...')).toBeInTheDocument();
+ });
+
+ it('reports a failed boards read with Retry, not "Couldn\'t auto-detect boards"', async () => {
+ api.getJiraProjects.mockResolvedValue([{ key: 'PROJ', name: 'Project' }]);
+ api.getJiraBoards.mockRejectedValueOnce(new Error('boards 500'));
+ renderApp({ projectKey: 'PROJ' });
+
+ expect(await screen.findByRole('alert')).toHaveTextContent('Could not load JIRA boards — boards 500');
+ expect(screen.queryByText(/auto-detect boards/)).not.toBeInTheDocument();
+
+ api.getJiraBoards.mockResolvedValue([{ id: 7, name: 'Board', type: 'scrum' }]);
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByRole('option', { name: /Board/ })).toBeInTheDocument();
+ });
+
+ it('reports a failed sprints read with Retry, not "No active sprint"', async () => {
+ api.getJiraProjects.mockResolvedValue([{ key: 'PROJ', name: 'Project' }]);
+ api.getJiraBoards.mockResolvedValue([{ id: 7, name: 'Board', type: 'scrum' }]);
+ api.getJiraBoardSprints.mockRejectedValueOnce(new Error('sprints 500'));
+ renderApp({ projectKey: 'PROJ', boardId: '7' });
+
+ expect(await screen.findByRole('alert')).toHaveTextContent('Could not load the board\'s sprints — sprints 500');
+ expect(screen.queryByText(/No active sprint/)).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByText(/No active sprint on this board/)).toBeInTheDocument();
+ });
+ });
});
diff --git a/client/src/listFetchConventions.test.js b/client/src/listFetchConventions.test.js
index 5e9238ddef..96977752bc 100644
--- a/client/src/listFetchConventions.test.js
+++ b/client/src/listFetchConventions.test.js
@@ -44,12 +44,18 @@ const SCAN_PREFIXES = ['src/pages/', 'src/components/'];
/**
* `.catch(() => [])`, `.catch(() => setX([]))`, the braced one-statement form
- * `.catch(() => { setX([]); })`, and the object-literal spelling
+ * `.catch(() => { setX([]); })` (optionally behind an `if (...)` guard such as
+ * `if (!cancelled)`), the keyed-map setter `setX((m) => ({ ...m, [id]: [] }))`
+ * (bare or braced), and the object-literal spelling
* `.catch(() => ({ agents: [], summary: {} }))` (a list under a key, one level
* of nested braces allowed). The setter must start with `set` + a capital, so
* `.catch(() => reset([]))` and a non-setter call stay out.
*/
-export const LIST_COLLAPSE = /\.catch\(\s*\(\s*\)\s*=>\s*(?:\[\]|\{?\s*set[A-Z]\w*\(\s*\[\]\s*\)\s*;?\s*\}?|\(\s*\{(?:[^{}]|\{[^{}]*\})*?\b\w+\s*:\s*\[\](?:[^{}]|\{[^{}]*\})*\}\s*\))\s*\)/g;
+const EMPTY_SETTER = String.raw`set[A-Z]\w*\(\s*(?:\[\]|\(\s*\w+\s*\)\s*=>\s*\(\s*\{\s*\.\.\.\w+\s*,\s*\[[^\]]+\]\s*:\s*\[\]\s*\}\s*\))\s*\)`;
+export const LIST_COLLAPSE = new RegExp(
+ String.raw`\.catch\(\s*\(\s*\)\s*=>\s*(?:\[\]|\{\s*(?:if\s*\([^()]*\)\s*)?${EMPTY_SETTER}\s*;?\s*\}|${EMPTY_SETTER}|\(\s*\{(?:[^{}]|\{[^{}]*\})*?\b\w+\s*:\s*\[\](?:[^{}]|\{[^{}]*\})*\}\s*\))\s*\)`,
+ 'g',
+);
/**
* Files still carrying a collapse, with how many. Lower or remove a row when a
@@ -57,6 +63,36 @@ export const LIST_COLLAPSE = /\.catch\(\s*\(\s*\)\s*=>\s*(?:\[\]|\{?\s*set[A-Z]\
*/
const KNOWN = Object.freeze({
'src/components/privacy/PrivacyOrgsTab.jsx': 2,
+ // Spellings the widened pattern (#12790) newly sees; migrated under #12804.
+ 'src/components/CmdKSearch.jsx': 1,
+ 'src/components/TagPicker.jsx': 1,
+ 'src/components/apps/LaunchVideoPanel.jsx': 1,
+ 'src/components/apps/tabs/OverviewTab.jsx': 1,
+ 'src/components/cos/tabs/MemoryRunsUsedBy.jsx': 1,
+ 'src/components/eidoverse/EidoverseTravel.jsx': 1,
+ 'src/components/media/RigPanel.jsx': 1,
+ 'src/components/messages/MessageDetail.jsx': 1,
+ 'src/components/music/ArtistPicker.jsx': 1,
+ 'src/components/musicVideo/CharacterStyleSelect.jsx': 1,
+ 'src/components/musicVideo/ExistingSongSelect.jsx': 1,
+ 'src/components/musicVideo/PromotionPlanPanel.jsx': 1,
+ 'src/components/pipeline/AuthorPicker.jsx': 1,
+ 'src/components/pipeline/SeriesLoomsPanel.jsx': 1,
+ 'src/components/pipeline/stages/EpisodeVideoStage.jsx': 1,
+ 'src/components/privacy/OrgDrawer.jsx': 1,
+ 'src/components/providers/ProviderServiceForm.jsx': 1,
+ 'src/components/settings/ImageGenProviderSections.jsx': 1,
+ 'src/components/settings/SecurityTab.jsx': 1,
+ 'src/components/songbook/SongLinks.jsx': 2,
+ 'src/components/sprites/SpriteReferencePicker.jsx': 1,
+ 'src/components/threads/AddToThreadButton.jsx': 1,
+ 'src/components/ui/ProcessLogModal.jsx': 1,
+ 'src/components/videoGen/GalleryVideoPicker.jsx': 1,
+ 'src/pages/Instances.jsx': 1,
+ 'src/pages/OpenClaw.jsx': 1,
+ 'src/pages/PipelineEditorialChecks.jsx': 2,
+ 'src/pages/PipelineExport.jsx': 1,
+ 'src/pages/Tribe.jsx': 3,
});
/**
@@ -64,6 +100,9 @@ const KNOWN = Object.freeze({
* They are not ratcheted down: the count is the number of intentional matches.
*/
const EXEMPT = Object.freeze({
+ // Epic-name typeahead: a failed search shows no suggestions, the typed key is
+ // validated separately (`epicValidation`), and nothing says "no epics exist".
+ 'src/components/apps/JiraConfigPanel.jsx': 1,
// `canDelete: true` on a failed usage read lets the server's own
// SYSTEM_STAGE_PROTECTED guard answer. The empty `usedBy`/`referencedBy` feed
// a delete-confirm prompt, not a library listing, so no "you have none" copy.
@@ -82,12 +121,17 @@ describe('page list fetches keep a failed read distinct from an empty list', ()
'load().catch(() => { setRows([]); })',
'getAppAgents(id).catch(() => ({ agents: [], summary: {} }))',
'getBranches(p).catch(() => ({ summary: {}, branches: [] }))',
+ 'getJiraBoards(i).catch(() => { if (!cancelled) setBoards([]); })',
+ 'listShareInbox(id).catch(() => setInboxByBucket((m) => ({ ...m, [bucketId]: [] })))',
+ 'listShareActivity(id).catch(() => { setActivityByBucket((m) => ({ ...m, [id]: [] })); })',
]) expect(countIn(sample), sample).toBe(1);
for (const sample of [
'listTracks().catch(() => setLoadError(true))',
'load().catch(() => { setRows([]); setFailed(true); })',
'load().catch(() => FETCH_FAILED)',
'getAppTaskTypes(id).catch(() => ({ taskTypeOverrides: {} }))',
+ 'load().catch(() => { if (!cancelled) { setRows([]); setFailed(true); } })',
+ 'load().catch(() => setInboxByBucket((m) => ({ ...m, [bucketId]: m[bucketId] })))',
'load().catch(() => ({ providers: [], error: true }))'.replace('[], error', 'x, error'),
]) expect(countIn(sample), sample).toBe(0);
});
diff --git a/client/src/pages/Sharing.jsx b/client/src/pages/Sharing.jsx
index 976303cff2..cfc736c7fb 100644
--- a/client/src/pages/Sharing.jsx
+++ b/client/src/pages/Sharing.jsx
@@ -7,7 +7,7 @@
* that get stamped as the source on every outgoing share.
*/
-import { useCallback, useEffect, useState } from 'react';
+import { useCallback, useEffect, useRef, useState } from 'react';
import { useParams, useNavigate } from 'react-router';
import {
Share2, Plus, Trash2, Folder, Inbox, History, Save, Loader2, Check, X, Users, AlertCircle, RefreshCw, Copy, GitMerge,
@@ -134,8 +134,21 @@ function SharingBuckets({ selectedId }) {
const [savedBio, setSavedBio] = useState('');
const [savingDisplayName, setSavingDisplayName] = useState(false);
- const [inboxByBucket, setInboxByBucket] = useState({}); // bucketId → items[]
- const [activityByBucket, setActivityByBucket] = useState({});
+ // Inbox + activity for the selected bucket. A failed read stays distinct from
+ // an empty bucket (error row + Retry, never "No pending imports.").
+ const fetchInbox = useCallback(
+ () => listShareInbox(selectedId, { silent: true }).then((r) => r?.items || []),
+ [selectedId],
+ );
+ const fetchActivity = useCallback(
+ () => listShareActivity(selectedId, { silent: true }).then((r) => r?.manifests || []),
+ [selectedId],
+ );
+ const inbox = useListResource(fetchInbox, { enabled: !!selectedId });
+ const activity = useListResource(fetchActivity, { enabled: !!selectedId });
+ // Socket handlers subscribe once; they read the latest hook state through this ref.
+ const liveRef = useRef(null);
+ liveRef.current = { selectedId, inbox, activity };
const { isConfirming: isRemoveArmed, requestDelete: armRemove, cancelDelete: cancelRemove, confirmDelete: confirmRemove } = useConfirmDelete();
@@ -166,33 +179,23 @@ function SharingBuckets({ selectedId }) {
}, []);
useEffect(() => { loadSettings(); }, [loadSettings]);
- // Lazy-load inbox + activity when a bucket is selected.
- const loadInbox = (bucketId) => {
- listShareInbox(bucketId, { silent: true })
- .then((r) => setInboxByBucket((m) => ({ ...m, [bucketId]: r?.items || [] })))
- .catch(() => setInboxByBucket((m) => ({ ...m, [bucketId]: [] })));
- };
- const loadActivity = (bucketId) => {
- listShareActivity(bucketId, { silent: true })
- .then((r) => setActivityByBucket((m) => ({ ...m, [bucketId]: r?.manifests || [] })))
- .catch(() => setActivityByBucket((m) => ({ ...m, [bucketId]: [] })));
- };
- useEffect(() => {
- if (!selectedId) return;
- loadInbox(selectedId);
- loadActivity(selectedId);
- }, [selectedId]);
-
- // Live socket updates: inbox changes + new manifests.
+ // Live socket updates: inbox changes + new manifests. A refresh that fails keeps
+ // the rows already shown; a resource already in error retries through the hook.
useEffect(() => {
+ const refresh = (resource, read, bucketId) => {
+ if (bucketId !== liveRef.current.selectedId) return;
+ if (resource.state === 'error') { resource.retry(); return; }
+ read(bucketId, { silent: true })
+ .then((r) => resource.setItems(resource === liveRef.current.inbox ? (r?.items || []) : (r?.manifests || [])))
+ .catch((err) => console.warn(`⚠️ Sharing refresh failed: ${err.message}`));
+ };
const onInboxUpdated = ({ bucketId }) => {
- if (bucketId) loadInbox(bucketId);
+ if (bucketId) refresh(liveRef.current.inbox, listShareInbox, bucketId);
};
const onManifestProcessed = ({ bucketId }) => {
- if (bucketId) {
- loadInbox(bucketId);
- loadActivity(bucketId);
- }
+ if (!bucketId) return;
+ refresh(liveRef.current.inbox, listShareInbox, bucketId);
+ refresh(liveRef.current.activity, listShareActivity, bucketId);
};
socket.on('sharing:inbox-updated', onInboxUpdated);
socket.on('sharing:manifest-processed', onManifestProcessed);
@@ -283,7 +286,7 @@ function SharingBuckets({ selectedId }) {
return null;
});
if (!result) return;
- setInboxByBucket((m) => ({ ...m, [bucketId]: (m[bucketId] || []).filter((it) => it.manifestId !== manifestId) }));
+ inbox.setItems((items) => items.filter((it) => it.manifestId !== manifestId));
const applied = result.outcome?.applied ?? 0;
toast.success(`Imported — ${applied} record${applied === 1 ? '' : 's'}`);
};
@@ -294,7 +297,7 @@ function SharingBuckets({ selectedId }) {
return null;
});
if (!result) return;
- setInboxByBucket((m) => ({ ...m, [bucketId]: (m[bucketId] || []).filter((it) => it.manifestId !== manifestId) }));
+ inbox.setItems((items) => items.filter((it) => it.manifestId !== manifestId));
};
const selected = buckets.find((b) => b.id === selectedId) || null;
@@ -477,7 +480,7 @@ function SharingBuckets({ selectedId }) {
) : (
<ul className="space-y-2">
{buckets.map((b) => {
- const inboxCount = (inboxByBucket[b.id] || []).length;
+ const inboxCount = selectedId === b.id && inbox.state === 'ready' ? inbox.items.length : 0;
const isSelected = selectedId === b.id;
const incompatible = b.schemaCompatible === false;
return (
@@ -536,7 +539,7 @@ function SharingBuckets({ selectedId }) {
<TabPills
tabs={BUCKET_TABS.map((tab) => (
tab.id === 'inbox'
- ? { ...tab, count: (inboxByBucket[selected.id] || []).length }
+ ? { ...tab, count: inbox.items.length }
: tab
))}
activeTab={activeTab}
@@ -550,13 +553,16 @@ function SharingBuckets({ selectedId }) {
{activeTab === 'inbox' && (
<Inboxlist
bucket={selected}
- items={inboxByBucket[selected.id] || []}
+ items={inbox.items}
+ state={inbox.state}
+ error={inbox.error}
+ onRetry={inbox.retry}
onPromote={(id) => handlePromote(selected.id, id)}
onDismiss={(id) => handleDismiss(selected.id, id)}
/>
)}
{activeTab === 'activity' && (
- <ActivityList manifests={activityByBucket[selected.id] || []} />
+ <ActivityList manifests={activity.items} state={activity.state} error={activity.error} onRetry={activity.retry} />
)}
{activeTab === 'settings' && (
<SettingsPanel
@@ -577,7 +583,7 @@ function SharingBuckets({ selectedId }) {
);
}
-function Inboxlist({ bucket, items, onPromote, onDismiss }) {
+function Inboxlist({ bucket, items, state, error, onRetry, onPromote, onDismiss }) {
if (bucket.mode === 'auto-merge') {
return (
<div className="p-4 bg-port-card border border-port-border rounded-lg text-sm text-gray-500 flex items-start gap-2">
@@ -588,6 +594,8 @@ function Inboxlist({ bucket, items, onPromote, onDismiss }) {
</div>
);
}
+ if (state === 'error') return <ListLoadError what="the inbox" error={error} onRetry={onRetry} />;
+ if (state === 'loading') return <div className="p-4 text-sm text-gray-500">Loading inbox…</div>;
if (items.length === 0) {
return <div className="p-4 bg-port-card border border-port-border rounded-lg text-sm text-gray-500">No pending imports.</div>;
}
@@ -658,7 +666,9 @@ function Inboxlist({ bucket, items, onPromote, onDismiss }) {
);
}
-function ActivityList({ manifests }) {
+function ActivityList({ manifests, state, error, onRetry }) {
+ if (state === 'error') return <ListLoadError what="share activity" error={error} onRetry={onRetry} />;
+ if (state === 'loading') return <div className="p-4 text-sm text-gray-500">Loading activity…</div>;
if (manifests.length === 0) {
return <div className="p-4 bg-port-card border border-port-border rounded-lg text-sm text-gray-500">No share activity yet.</div>;
}
diff --git a/client/src/pages/Sharing.test.jsx b/client/src/pages/Sharing.test.jsx
index 3f67b3cb67..826854ab15 100644
--- a/client/src/pages/Sharing.test.jsx
+++ b/client/src/pages/Sharing.test.jsx
@@ -152,6 +152,30 @@ describe('Sharing list and settings reads', () => {
expect((await screen.findAllByText('Bucket One')).length).toBeGreaterThan(0);
});
+ it('shows an error row with Retry when the inbox read fails, not "No pending imports."', async () => {
+ api.listShareBuckets.mockResolvedValue({ buckets: [{ id: 'b1', name: 'Bucket One', path: '/tmp/b1', mode: 'inbox' }] });
+ api.listShareInbox.mockRejectedValueOnce(new Error('inbox 500'));
+ renderAt('/sharing/buckets/b1?tab=inbox');
+
+ expect(await screen.findByRole('alert')).toHaveTextContent('Could not load the inbox — inbox 500');
+ expect(screen.queryByText('No pending imports.')).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByText('No pending imports.')).toBeInTheDocument();
+ });
+
+ it('shows an error row with Retry when the activity read fails, not "No share activity yet."', async () => {
+ api.listShareBuckets.mockResolvedValue({ buckets: [{ id: 'b1', name: 'Bucket One', path: '/tmp/b1', mode: 'inbox' }] });
+ api.listShareActivity.mockRejectedValueOnce(new Error('activity 500'));
+ renderAt('/sharing/buckets/b1?tab=activity');
+
+ expect(await screen.findByRole('alert')).toHaveTextContent('Could not load share activity — activity 500');
+ expect(screen.queryByText('No share activity yet.')).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByText('No share activity yet.')).toBeInTheDocument();
+ });
+
it('locks the display-name editor when the settings read fails so a save cannot replace stored values', async () => {
api.listShareBuckets.mockResolvedValue({ buckets: [] });
api.getSettings.mockRejectedValueOnce(new Error('settings 500'));