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
address review (round 14): fallback layout + preserve palette layouts on transient error
Adam Eivyb0c06231c8b7
diff --git a/client/src/components/CmdKSearch.jsx b/client/src/components/CmdKSearch.jsxindex f931a81c02..8af965a8e5 100644--- a/client/src/components/CmdKSearch.jsx+++ b/client/src/components/CmdKSearch.jsx@@ -122,10 +122,15 @@ export default function CmdKSearch() {useEffect(() => {if (!open) return;let cancelled = false;+ let fetchOk = true;getDashboardLayouts()- .catch(() => ({ layouts: [] }))+ .catch(() => { fetchOk = false; return { layouts: [] }; }).then((dashboards) => {if (cancelled) return;+ // Transient failure: preserve the previously-loaded layouts rather+ // than wiping "Dashboard: …" commands out of the palette until the+ // next successful open.+ if (!fetchOk) return;const layouts = (dashboards?.layouts || []).map((l) => precompute({id: `layout.${l.id}`,layoutId: l.id,diff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsxindex 138b33e91c..9914c0233b 100644--- a/client/src/components/dashboard/widgetRegistry.jsx+++ b/client/src/components/dashboard/widgetRegistry.jsx@@ -38,6 +38,16 @@ export const WIDGETS = [export const WIDGETS_BY_ID = Object.fromEntries(WIDGETS.map((w) => [w.id, w]));+// Local fallback used when the layouts endpoint is unreachable. Keeps the+// dashboard usable during a transient server outage instead of rendering a+// blank page. Intentionally minimal — the full built-ins live server-side.+export const FALLBACK_LAYOUT = Object.freeze({+ id: '_fallback',+ name: 'Default (offline)',+ builtIn: true,+ widgets: ['apps', 'cos', 'upcoming-tasks', 'system-health'],+});+export const WIDTH_CLASS = {full: 'col-span-12',half: 'col-span-12 md:col-span-6',diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex a7cf59fe95..59bd88df27 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';import BrailleSpinner from '../components/BrailleSpinner';import LayoutPicker from '../components/dashboard/LayoutPicker';import LayoutEditor from '../components/dashboard/LayoutEditor';-import { WIDGETS_BY_ID, WIDTH_CLASS } from '../components/dashboard/widgetRegistry.jsx';+import { WIDGETS_BY_ID, WIDTH_CLASS, FALLBACK_LAYOUT } from '../components/dashboard/widgetRegistry.jsx';import { DASHBOARD_LAYOUT_CHANGED } from '../constants/events.js';import { Monitor } from 'lucide-react';import * as api from '../services/api';@@ -87,8 +87,13 @@ export default function Dashboard() {[apps, sortedApps, activeApps, appStats, health, usage, fetchData]);+ // Falls back to a local minimal layout when the /api/dashboard/layouts+ // endpoint is unreachable (first load + transient outages). A failed+ // refresh preserves the prior `layouts` (the .catch() branch doesn't+ // reset them) but a failed initial load would otherwise leave the grid+ // blank — the fallback keeps the dashboard usable until recovery.const activeLayout = useMemo(- () => layouts.find((l) => l.id === activeLayoutId) || layouts[0],+ () => layouts.find((l) => l.id === activeLayoutId) || layouts[0] || FALLBACK_LAYOUT,[layouts, activeLayoutId]);