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
fix(ui): writers room loaded empty in dev + reach siblings from collapsed sidebar
Adam Eivy59d1d242a1c3
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdnew file mode 100644index 0000000000..77c35437b0--- /dev/null+++ b/.changelog/NEXT.md@@ -0,0 +1,13 @@+# Unreleased Changes++## Added++- **Collapsed-sidebar section flyout.** Hovering or focusing any multi-child section icon (Brain, Calendar, Chief of Staff, Comms, Create, Dev Tools, Digital Twin, MeatSpace, POST, Settings, System, Wiki) while the sidebar is collapsed opens a fixed-position popover to its right listing the section's children — so siblings (e.g. **Writers Room** under **Create**, which defaults to Media Gen) stay reachable without expanding the whole sidebar. Clicking a child navigates and closes the flyout; a 180 ms grace period lets the user move from icon → popover without it snapping shut. Renders via `position: fixed` so it escapes the nav scroller's `overflow-x-hidden` clipping. ARIA: `role="menu"` + `aria-haspopup="menu"` + `aria-expanded` on the trigger; keyboard focus on the icon also opens the flyout.++## Changed++## Fixed++- **Writers Room loaded empty in dev (Vite on `:5554`) while production worked.** All five `mountedRef` guards in the Writers Room and Ask pages used `useRef(true)` plus a cleanup-only `useEffect(() => () => { mountedRef.current = false; }, [])` to skip post-`await` `setState` after unmount. In React 18 `<StrictMode>` (dev only), the mount → cleanup → mount cycle flipped the ref to `false` permanently and never reset it, so every async fetch resolved with the guard tripped and folders/works/exercises/analyses/draft saves never reached state. Fixed by setting `mountedRef.current = true` at the top of the same effect — production builds (port `:5553`/`:5555`) were unaffected because StrictMode does not double-mount in production. Touched: `client/src/pages/WritersRoom.jsx`, `client/src/components/writers-room/{ExercisePanel,AiPanel,WorkEditor}.jsx`, `client/src/pages/Ask.jsx`.++## Removeddiff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 790b4127bb..86dee7a4a0 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -1,4 +1,4 @@-import { useState, useEffect, useMemo } from 'react';+import { useState, useEffect, useMemo, useRef, useCallback } from 'react';import { Outlet, NavLink, useLocation, useNavigate } from 'react-router-dom';import {Home,@@ -318,6 +318,28 @@ export default function Layout() {});const [mobileOpen, setMobileOpen] = useState(false);const [expandedSections, setExpandedSections] = useState({});+ // Collapsed-sidebar flyout: hovering or focusing a section icon opens a+ // fixed-position popover to the right listing the section's children, so the+ // user can reach siblings (e.g. Writers Room from Create) without expanding+ // the whole sidebar. Tracks which section is open and the icon's screen rect.+ const [flyoutSection, setFlyoutSection] = useState(null);+ const [flyoutPos, setFlyoutPos] = useState({ top: 0, left: 0 });+ const flyoutCloseTimer = useRef(null);+ const openFlyout = useCallback((event, label) => {+ clearTimeout(flyoutCloseTimer.current);+ const rect = event.currentTarget.getBoundingClientRect();+ setFlyoutPos({ top: rect.top, left: rect.right + 4 });+ setFlyoutSection(label);+ }, []);+ const scheduleCloseFlyout = useCallback(() => {+ clearTimeout(flyoutCloseTimer.current);+ flyoutCloseTimer.current = setTimeout(() => setFlyoutSection(null), 180);+ }, []);+ const cancelCloseFlyout = useCallback(() => clearTimeout(flyoutCloseTimer.current), []);+ useEffect(() => () => clearTimeout(flyoutCloseTimer.current), []);+ // Close any open flyout immediately on navigation so a stale popover doesn't+ // hang over the next page.+ useEffect(() => { setFlyoutSection(null); }, [location.pathname]);// Subscribe to server error notificationsuseErrorNotifications();@@ -519,14 +541,24 @@ export default function Layout() {: 'text-gray-400 hover:text-white hover:bg-port-border/50'}`;+ const hasChildrenForFlyout = collapsed && Array.isArray(item.children) && item.children.length > 0;+return (<div key={item.label} className="mx-2 min-w-0">- <div className={`flex items-stretch min-w-0 ${collapsed ? 'lg:justify-center' : ''}`}>+ <div+ className={`flex items-stretch min-w-0 ${collapsed ? 'lg:justify-center' : ''}`}+ onMouseEnter={hasChildrenForFlyout ? (e) => openFlyout(e, item.label) : undefined}+ onMouseLeave={hasChildrenForFlyout ? scheduleCloseFlyout : undefined}+ onFocus={hasChildrenForFlyout ? (e) => openFlyout(e, item.label) : undefined}+ onBlur={hasChildrenForFlyout ? scheduleCloseFlyout : undefined}+ ><buttontype="button"onClick={navigateToSection}className={`flex-1 min-w-0 ${sectionRowClasses} ${collapsed ? 'lg:justify-center lg:px-2' : 'justify-between'}`}title={collapsed ? item.label : undefined}+ aria-haspopup={hasChildrenForFlyout ? 'menu' : undefined}+ aria-expanded={hasChildrenForFlyout ? flyoutSection === item.label : undefined}><div className="flex items-center gap-3 min-w-0"><div className="relative">@@ -726,6 +758,78 @@ export default function Layout() {</div></aside>+ {/* Collapsed-sidebar section flyout — fixed-position so it escapes the+ nav scroller's overflow clipping. Opens on hover/focus of a section+ icon when the sidebar is collapsed; lists the section's children so+ siblings (e.g. Writers Room under Create) stay reachable without+ fully expanding the sidebar. */}+ {collapsed && flyoutSection && (() => {+ const item = resolvedNavItems.find((i) => i.label === flyoutSection);+ if (!item || !item.children || item.children.length === 0) return null;+ return (+ <div+ role="menu"+ aria-label={`${item.label} pages`}+ onMouseEnter={cancelCloseFlyout}+ onMouseLeave={scheduleCloseFlyout}+ style={{ top: flyoutPos.top, left: flyoutPos.left, position: 'fixed' }}+ className="hidden lg:block z-[60] min-w-[200px] bg-port-card border border-port-border rounded-lg shadow-2xl py-1"+ >+ <div className="px-3 py-1.5 text-[10px] uppercase text-gray-500 tracking-wider border-b border-port-border mb-1">+ {item.label}+ </div>+ {item.children.map((child, childIndex) => {+ if (child.separator) {+ return <div key={`flyout-sep-${childIndex}`} className="mx-3 my-1 border-t border-port-border" />;+ }+ const ChildIcon = child.icon;+ if (child.external) {+ const childHref = child.dynamicHost+ ? `${window.location.protocol}//${window.location.hostname}${child.href.replace('//', '')}`+ : child.href;+ return (+ <a+ key={`flyout-${child.href}`}+ href={childHref}+ target="_blank"+ rel="noopener noreferrer"+ role="menuitem"+ onClick={() => setFlyoutSection(null)}+ className="flex items-center justify-between gap-3 px-3 py-2 text-sm text-gray-300 hover:text-white hover:bg-port-border/50 min-w-0"+ >+ <div className="flex items-center gap-3 min-w-0">+ <ChildIcon size={16} aria-hidden="true" />+ <span className="min-w-0 truncate">{child.label}</span>+ </div>+ <ExternalLink size={12} className="text-gray-500" />+ </a>+ );+ }+ const childActive = child.end+ ? location.pathname === child.to+ : isActive(child.to);+ return (+ <NavLink+ key={`flyout-${child.to}`}+ to={child.to}+ end={child.end}+ role="menuitem"+ onClick={() => setFlyoutSection(null)}+ className={`flex items-center gap-3 px-3 py-2 text-sm min-w-0 ${+ childActive+ ? 'bg-port-accent/10 text-port-accent'+ : 'text-gray-300 hover:text-white hover:bg-port-border/50'+ }`}+ >+ <ChildIcon size={16} className="shrink-0" aria-hidden="true" />+ <span className="min-w-0 truncate">{child.label}</span>+ </NavLink>+ );+ })}+ </div>+ );+ })()}+{/* Main area */}<div className={`flex-1 flex flex-col min-w-0 max-w-full transition-all duration-300 ${collapsed ? 'lg:ml-16' : 'lg:ml-56'}`}>{/* Mobile header */}diff --git a/client/src/components/writers-room/AiPanel.jsx b/client/src/components/writers-room/AiPanel.jsxindex 46b940309c..d779831ce0 100644--- a/client/src/components/writers-room/AiPanel.jsx+++ b/client/src/components/writers-room/AiPanel.jsx@@ -52,7 +52,10 @@ export default function AiPanel({ work, onApplyFormat, readingTheme = 'dark' })const [details, setDetails] = useState({});const mountedRef = useRef(true);- useEffect(() => () => { mountedRef.current = false; }, []);+ useEffect(() => {+ mountedRef.current = true;+ return () => { mountedRef.current = false; };+ }, []);const activeDraft = (work.drafts || []).find((d) => d.id === work.activeDraftVersionId);const activeHash = activeDraft?.contentHash || null;diff --git a/client/src/components/writers-room/ExercisePanel.jsx b/client/src/components/writers-room/ExercisePanel.jsxindex 640bfadbc8..d0af0c3183 100644--- a/client/src/components/writers-room/ExercisePanel.jsx+++ b/client/src/components/writers-room/ExercisePanel.jsx@@ -26,7 +26,10 @@ export default function ExercisePanel({ activeWork, onClose }) {const tickRef = useRef(null);const mountedRef = useRef(true);- useEffect(() => () => { mountedRef.current = false; }, []);+ useEffect(() => {+ mountedRef.current = true;+ return () => { mountedRef.current = false; };+ }, []);const refresh = useCallback(async () => {// Capture the workId we asked for so a slow response from the previousdiff --git a/client/src/components/writers-room/WorkEditor.jsx b/client/src/components/writers-room/WorkEditor.jsxindex b31d49f0cd..c4c11be27b 100644--- a/client/src/components/writers-room/WorkEditor.jsx+++ b/client/src/components/writers-room/WorkEditor.jsx@@ -80,7 +80,10 @@ export default function WorkEditor({ work, onChange }) {// Skip post-await setState if the editor unmounted (rapid work-switch or// page nav while a save / snapshot / status PATCH is in flight).const mountedRef = useRef(true);- useEffect(() => () => { mountedRef.current = false; }, []);+ useEffect(() => {+ mountedRef.current = true;+ return () => { mountedRef.current = false; };+ }, []);// Refs let the once-bound keydown listener read the freshest body/saving// values without re-registering on every keystroke. The savingRef gate isdiff --git a/client/src/pages/Ask.jsx b/client/src/pages/Ask.jsxindex ef97aa0bc5..fef7f92464 100644--- a/client/src/pages/Ask.jsx+++ b/client/src/pages/Ask.jsx@@ -389,11 +389,14 @@ export default function Ask() {// checked from `handleSend`'s post-stream cleanup so it can skip state// writes if we get there after unmount.const mountedRef = useRef(true);- useEffect(() => () => {- mountedRef.current = false;- abortRef.current?.abort();- abortRef.current = null;- streamingConvIdRef.current = null;+ useEffect(() => {+ mountedRef.current = true;+ return () => {+ mountedRef.current = false;+ abortRef.current?.abort();+ abortRef.current = null;+ streamingConvIdRef.current = null;+ };}, []);const startNew = useCallback(() => {diff --git a/client/src/pages/WritersRoom.jsx b/client/src/pages/WritersRoom.jsxindex 3bedfb4219..900c2988e5 100644--- a/client/src/pages/WritersRoom.jsx+++ b/client/src/pages/WritersRoom.jsx@@ -34,9 +34,13 @@ export default function WritersRoom() {}, []);// Skip setState when an in-flight library or work fetch resolves after the- // page unmounts (rapid nav across pages).+ // page unmounts (rapid nav across pages). Reset on mount so React 18+ // StrictMode's mount→cleanup→remount cycle doesn't leave the ref stuck false.const mountedRef = useRef(true);- useEffect(() => () => { mountedRef.current = false; }, []);+ useEffect(() => {+ mountedRef.current = true;+ return () => { mountedRef.current = false; };+ }, []);const refreshLibrary = useCallback(async () => {const [foldersList, worksList] = await Promise.all([