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(digital-twin): don't open a list enrichment as blank when its saved list fails to load

[._.]/ Adam Eivyab9cc2ba1994
diff --git a/client/src/components/digital-twin/ListEnrichment.jsx b/client/src/components/digital-twin/ListEnrichment.jsx
index d1defa511c..4aa34cbb69 100644
--- a/client/src/components/digital-twin/ListEnrichment.jsx
+++ b/client/src/components/digital-twin/ListEnrichment.jsx
@@ -11,6 +11,7 @@ import {ArrowLeft,
Check} from 'lucide-react';
import * as api from '../../services/api';
import toast from '../ui/Toast';
+import ListLoadError from '../ui/ListLoadError';
import BrailleSpinner from '../BrailleSpinner';
import { FormField } from '../ui/FormField';
import TwinProviderPicker from './TwinProviderPicker.jsx';
@@ -40,6 +41,7 @@ export default function ListEnrichment({
// List items state
const [items, setItems] = useState(() => [mkItem()]);
const [loadingItems, setLoadingItems] = useState(true);
+ const [itemsError, setItemsError] = useState(null);
// Analysis state
const [analyzing, setAnalyzing] = useState(false);
@@ -57,10 +59,14 @@ export default function ListEnrichment({
const loadExistingItems = useCallback(async () => {
setLoadingItems(true);
- const existingItems = await api.getEnrichmentListItems(categoryId).catch(() => []);
- if (existingItems && existingItems.length > 0) {
+ setItemsError(null);
+ // A failed read must not seed a blank editor: saving from it replaces the
+ // stored list and its document with whatever was retyped.
+ const existingItems = await api.getEnrichmentListItems(categoryId, { silent: true })
+ .catch((err) => { setItemsError(err); return null; });
+ if (existingItems?.length > 0) {
setItems(existingItems.map(({ title, note }) => mkItem(title, note)));
- } else {
+ } else if (existingItems) {
setItems([mkItem()]);
}
setLoadingItems(false);
@@ -156,6 +162,21 @@ export default function ListEnrichment({
);
}
+ if (itemsError) {
+ return (
+ <div className="max-w-3xl mx-auto px-1 space-y-4">
+ <button
+ onClick={onBack}
+ className="flex items-center gap-2 text-gray-400 hover:text-white py-2 min-h-[44px]"
+ >
+ <ArrowLeft size={18} />
+ Back to categories
+ </button>
+ <ListLoadError what="your saved list" error={itemsError} onRetry={loadExistingItems} />
+ </div>
+ );
+ }
+
return (
<div className="max-w-3xl mx-auto px-1">
{/* Header */}
diff --git a/client/src/components/digital-twin/ListEnrichment.test.jsx b/client/src/components/digital-twin/ListEnrichment.test.jsx
index 4055bcca04..83901d5680 100644
--- a/client/src/components/digital-twin/ListEnrichment.test.jsx
+++ b/client/src/components/digital-twin/ListEnrichment.test.jsx
@@ -39,6 +39,32 @@ const renderAnalyzed = async () => {
await screen.findByRole('button', { name: /Patterns Detected/i });
};
+describe('ListEnrichment saved list read', () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it('shows a failed read as a retryable error instead of a blank list a save would replace', async () => {
+ api.getEnrichmentListItems.mockRejectedValueOnce(new Error('boom'));
+ api.getEnrichmentListItems.mockResolvedValue([{ title: 'Example Book', note: '' }]);
+ render(
+ <ListEnrichment
+ categoryId="favorite_books"
+ onBack={() => {}}
+ onRefresh={() => {}}
+ providers={[]}
+ selectedProvider={null}
+ setSelectedProvider={() => {}}
+ />
+ );
+
+ expect(await screen.findByText(/Could not load your saved list/)).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /Analyze & Generate/i })).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByDisplayValue('Example Book')).toBeInTheDocument();
+ expect(api.getEnrichmentListItems).toHaveBeenCalledWith('favorite_books', { silent: true });
+ });
+});
+
describe('ListEnrichment analysis disclosures', () => {
beforeEach(() => vi.clearAllMocks());
diff --git a/client/src/listFetchConventions.test.js b/client/src/listFetchConventions.test.js
index 61ee1bcd2f..16249b7ab9 100644
--- a/client/src/listFetchConventions.test.js
+++ b/client/src/listFetchConventions.test.js
@@ -66,7 +66,6 @@ const KNOWN = Object.freeze({
'src/components/cos/tabs/JobsTab.jsx': 1,
'src/components/cos/tabs/ProviderStatusCard.jsx': 1,
'src/components/cos/tabs/RunsTab.jsx': 1,
- 'src/components/digital-twin/ListEnrichment.jsx': 1,
'src/components/digital-twin/ObservedTasteEvidence.jsx': 1,
'src/components/digital-twin/tabs/AccountsTab.jsx': 3,
'src/components/digital-twin/tabs/AutobiographyTab.jsx': 3,
diff --git a/client/src/services/apiDigitalTwin.js b/client/src/services/apiDigitalTwin.js
index dab761bee8..07b110dbe4 100644
--- a/client/src/services/apiDigitalTwin.js
+++ b/client/src/services/apiDigitalTwin.js
@@ -170,7 +170,7 @@ export const saveEnrichmentList = (category, content, items, options = {}) => re
body: JSON.stringify({ category, content, items }),
...options
});
-export const getEnrichmentListItems = (category) => request(`/digital-twin/enrich/list-items/${category}`);
+export const getEnrichmentListItems = (category, options) => request(`/digital-twin/enrich/list-items/${category}`, options);
// Digital Twin Traits & Confidence
export const getDigitalTwinTraits = () => request('/digital-twin/traits');