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: show a holdings load error with Retry instead of "No holdings recorded" when an org's holdings read fails (#12784)

Adam Eivy4970c2014bb8
diff --git a/client/src/components/privacy/PrivacyOrgsTab.jsx b/client/src/components/privacy/PrivacyOrgsTab.jsx
index 012c0c7842..d58c527bbd 100644
--- a/client/src/components/privacy/PrivacyOrgsTab.jsx
+++ b/client/src/components/privacy/PrivacyOrgsTab.jsx
@@ -43,7 +43,7 @@ export default function PrivacyOrgsTab({ subjectId }) {
const [vaultRecords, setVaultRecords] = useState([]);
const [orgsError, setOrgsError] = useState(null);
const [vaultError, setVaultError] = useState(null);
- const [holdingsByOrg, setHoldingsByOrg] = useState({}); // orgId -> [holdings]
+ const [holdingsByOrg, setHoldingsByOrg] = useState({}); // orgId -> [holdings], or null when that read failed
const [loading, setLoading] = useState(true);
const [filters, setFilters] = useState({ trust: null, category: null, status: null });
const [drawerOpen, setDrawerOpen] = useState(false);
@@ -51,6 +51,11 @@ export default function PrivacyOrgsTab({ subjectId }) {
const [confirmDelete, setConfirmDelete] = useState(null);
const beginRequest = useLatestRequest();
+ // null marks a failed read, so a badge row never claims "No holdings recorded" for it.
+ const readHoldings = (orgId) => getOrgHoldings(orgId, { silent: true })
+ .then((h) => [orgId, h || []])
+ .catch(() => [orgId, null]);
+
const load = useCallback(() => {
const isCurrent = beginRequest();
setLoading(true);
@@ -63,10 +68,7 @@ export default function PrivacyOrgsTab({ subjectId }) {
if (!isCurrent()) return;
setOrgs(orgList);
// One request per org (single-user scale — a handful of orgs).
- const entries = await Promise.all(orgList.map(async (org) => {
- const h = await getOrgHoldings(org.id, { silent: true }).catch(() => []);
- return [org.id, h || []];
- }));
+ const entries = await Promise.all(orgList.map((org) => readHoldings(org.id)));
if (isCurrent()) setHoldingsByOrg(Object.fromEntries(entries));
})
.catch((err) => { if (isCurrent()) { setOrgs([]); setHoldingsByOrg({}); setOrgsError(err); } });
@@ -87,8 +89,13 @@ export default function PrivacyOrgsTab({ subjectId }) {
setDrawerOpen(false);
setOrgs((prev) => (wasEditing ? prev.map((o) => (o.id === savedOrg.id ? savedOrg : o)) : [...prev, savedOrg]));
// Refresh this org's holdings badges.
- const h = await getOrgHoldings(savedOrg.id, { silent: true }).catch(() => []);
- setHoldingsByOrg((prev) => ({ ...prev, [savedOrg.id]: h || [] }));
+ const [, h] = await readHoldings(savedOrg.id);
+ setHoldingsByOrg((prev) => ({ ...prev, [savedOrg.id]: h }));
+ };
+
+ const retryHoldings = async (orgId) => {
+ const [, h] = await readHoldings(orgId);
+ setHoldingsByOrg((prev) => ({ ...prev, [orgId]: h }));
};
const handleDelete = async (org) => {
@@ -162,7 +169,9 @@ export default function PrivacyOrgsTab({ subjectId }) {
)}
</div>
<div className="mt-2 flex items-center gap-1.5 flex-wrap">
- {Object.keys(counts).length === 0 ? (
+ {holdingsByOrg[org.id] === null ? (
+ <ListLoadError what="holdings" onRetry={() => retryHoldings(org.id)} className="py-1" />
+ ) : Object.keys(counts).length === 0 ? (
<span className="text-[11px] text-gray-600">No holdings recorded</span>
) : (
ORG_HOLDING_STATUSES.filter((s) => counts[s.id]).map((s) => (
diff --git a/client/src/components/privacy/PrivacyOrgsTab.test.jsx b/client/src/components/privacy/PrivacyOrgsTab.test.jsx
index 5371ab2646..1a180f41c6 100644
--- a/client/src/components/privacy/PrivacyOrgsTab.test.jsx
+++ b/client/src/components/privacy/PrivacyOrgsTab.test.jsx
@@ -34,4 +34,19 @@ describe('PrivacyOrgsTab', () => {
fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
expect(await screen.findByText('Acme Bank')).toBeInTheDocument();
});
+
+ it('shows a holdings error instead of "No holdings recorded" when a badge read fails, and Retry restores it', async () => {
+ api.getPrivacyOrgs.mockResolvedValue([{ id: 'org-1', name: 'Acme Bank', category: 'bank', trust: 'trusted', status: 'active' }]);
+ api.getVaultRecords.mockResolvedValue([]);
+ api.getOrgHoldings.mockRejectedValueOnce(new Error('holdings down'));
+ api.getOrgHoldings.mockResolvedValue([{ vaultRecordId: 'v1', status: 'current' }]);
+ render(<PrivacyOrgsTab subjectId="self" />);
+
+ expect(await screen.findByText(/Could not load holdings/)).toBeInTheDocument();
+ expect(screen.queryByText('No holdings recorded')).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByText(/1 current/i)).toBeInTheDocument();
+ expect(screen.queryByText(/Could not load holdings/)).not.toBeInTheDocument();
+ });
});
diff --git a/client/src/listFetchConventions.test.js b/client/src/listFetchConventions.test.js
index e9448ef00c..da8a0fccf8 100644
--- a/client/src/listFetchConventions.test.js
+++ b/client/src/listFetchConventions.test.js
@@ -69,7 +69,6 @@ export const LIST_COLLAPSE = new RegExp(
* site is migrated to `useListResource`; never raise one.
*/
const KNOWN = Object.freeze({
- 'src/components/privacy/PrivacyOrgsTab.jsx': 2,
// Named-parameter, multi-statement spelling (#12807); migrated under #12819.
'src/components/loraTraining/CharacterLoraChip.jsx': 1,
'src/components/meatspace/post/MemoryPractice.jsx': 1,