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: resolve pinned nav rows from the bundled manifest instead of refetching it (#6362)

Adam Eivy436561fd33bf
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 5d2842a134..c8beb6e786 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -160,7 +160,6 @@ function ThemeModeToggle({ className = '' }) {
</button>
);
}
-import * as api from '../services/api';
// `NAV_COMMANDS` owns every structural field shared with the sidebar. This map
// intentionally contains presentation only: giving a manifest path an icon is
@@ -758,25 +757,20 @@ export default function Layout() {
const pipelineSeries = useSidebarSeries();
const universes = useSidebarUniverses();
- // Fetch the palette nav manifest once on mount so manifest-only paths
- // (e.g. /wiki/log, /goals/tree) can be resolved in the Pinned/Recent sections
- // even though they are not sidebar leaves.
- const [manifestNav, setManifestNav] = useState([]);
- useEffect(() => {
- api.getPaletteManifest({ silent: true })
- .then((data) => setManifestNav(Array.isArray(data?.nav) ? data.nav : []))
- .catch((err) => console.warn(`⚠️ Layout: palette manifest fetch failed: ${err?.message || err}`));
- }, []);
-
- // Manifest-only paths still honour the feature gate, so a row pinned before the
- // user disabled its feature stops resolving into Pinned/Recent too.
+ // Manifest-only paths (e.g. /wiki/log, /goals/tree) have no sidebar leaf, so
+ // they resolve out of the statically imported manifest that already backs
+ // `commandByPath`. Reading the bundle instead of re-fetching `/palette/manifest`
+ // is what lets a Pinned/Recent row for one of those paths render on the FIRST
+ // paint rather than popping in once a request lands (and keeps it rendering on
+ // an install where that request fails). They still honour the feature gate, so
+ // a row pinned before the user disabled its feature stops resolving too.
const manifestEntryByPath = useMemo(() => {
const map = new Map();
- filterNavByFeatures(manifestNav, isFeatureEnabled).forEach((c) => {
- if (c?.path && !map.has(c.path)) map.set(c.path, { path: c.path, label: c.label, icon: Navigation });
+ filterNavByFeatures([...commandByPath.values()], isFeatureEnabled).forEach((c) => {
+ map.set(c.path, { path: c.path, label: c.label, icon: Navigation });
});
return map;
- }, [manifestNav, isFeatureEnabled]);
+ }, [isFeatureEnabled]);
useEffect(() => {
safeWriteStorage(SIDEBAR_KEY, String(collapsed));
@@ -881,11 +875,11 @@ export default function Layout() {
(path) => {
const direct = navEntryByPath.get(path) || manifestEntryByPath.get(path);
if (direct) return direct;
- const current = migrateLegacyNavPath(path, manifestNav);
+ const current = migrateLegacyNavPath(path, NAV_COMMANDS);
if (current === path) return null;
return navEntryByPath.get(current) || manifestEntryByPath.get(current) || null;
},
- [navEntryByPath, manifestEntryByPath, manifestNav],
+ [navEntryByPath, manifestEntryByPath],
);
const { pinned, recent, pin, unpin, isPinned } = useNavWorkingSet(resolveNavEntry);
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index f0c74e6f23..78c1a3f12c 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -72,14 +72,6 @@ vi.mock('../services/api', () => ({
getApps: vi.fn(() => Promise.resolve([])),
listPipelineSeries: vi.fn(() => Promise.resolve([])),
listUniverses: vi.fn(() => Promise.resolve([])),
- getPaletteManifest: vi.fn(() => Promise.resolve({
- nav: [{
- path: '/eidoverse',
- label: 'Eidoverse Worlds',
- feature: 'eidoverse',
- previousPaths: ['/openworld', '/city'],
- }],
- })),
getDailyActions: vi.fn(() => Promise.resolve({ actions: [] })),
getInstanceFeatures: vi.fn(() => Promise.resolve({ features: featureMock.features })),
}));
@@ -210,6 +202,25 @@ describe('Layout — pinned single nav rows', () => {
expect(pinnedSection()).toBeNull();
});
+ it('renders a pinned manifest-only path on the first paint, with no network mock', async () => {
+ // `/wiki/log` has a NAV_COMMANDS entry but no sidebar presentation, so it
+ // resolves only through `manifestEntryByPath`. That map is derived from the
+ // statically imported manifest, so the row must be in the DOM on the very
+ // first render — assert BEFORE the act() flush renderLayout does, which is
+ // what a fetch-backed manifest would have needed to land.
+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/wiki/log']));
+ render(
+ <MemoryRouter initialEntries={['/brain/inbox']}>
+ <Layout />
+ </MemoryRouter>,
+ );
+
+ const pinned = pinnedSection();
+ expect(pinned).toBeTruthy();
+ expect(within(pinned).getByRole('link', { name: /Log/i })).toHaveAttribute('href', '/wiki/log');
+ await act(async () => {});
+ });
+
it('filters out an unknown pinned path while keeping the known one', async () => {
// A stored path that maps to no nav leaf and no manifest entry resolves to
// null and is dropped by resolveNavEntry; a known path beside it still renders.