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: make Wiki Browse a responsive list/detail instead of fixed two-pane (#2551)

Adam Eivy61d6ce01a21a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a5080859ff..7a57f0b5a6 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -19,6 +19,7 @@
- **[issue-2538] Bound Spotify auth and privacy-broker fetches, and single-flight token refresh.** The Spotify token endpoint (`spotifyAuth.js`) and the BADBOOL / CA-registry broker fetchers (`privacyBrokers.js`) used bare `fetch` with no timeout, so a hung `accounts.spotify.com` could stall an OAuth callback or a history-sync refresh — and a broker source that never responded could hang a user-triggered refresh — indefinitely. All three now go through the shared `fetchWithTimeout` helper with a 15s cap. Separately, concurrent `getAccessToken()` callers that all found the token expired each POSTed their own refresh, and since Spotify rotates the grant the losers persisted a stale token (last-write-wins); refreshes now share one in-flight `refreshPromise` (single-flight), so the grant is rotated exactly once and the guard is released on settle so a failed refresh can retry.
- **[issue-2544] Wiki vault selection now lives in the URL.** The selected Obsidian vault was local `useState`, so a reload, shared link, ⌘K jump, or voice nav always landed you back on the first vault. The vault is now encoded as a `?vault=<id>` search param (the tab route param is preserved when switching tabs), selection is driven from the URL, and a stale/deleted vault id renders a "Vault not found" fallback with a one-click "Show default vault" recovery.
- **POST Digit Span: the form no longer jumps up as digits flash on and off.** During the show phase the visible-digit slot collapsed to zero height in the blank gaps between digits, so the container (padding + `min-h`) oscillated and the recall form/progress bar below shifted up on every flash. The slot now reserves its line box with a non-breaking space in the gaps, keeping the layout steady while digits flash.
+- **[issue-2551] Wiki Browse is now a responsive list/detail instead of a fixed two-pane.** The Browse tab always rendered a horizontal two-pane layout with a fixed `w-80` left rail and a magic `calc(100dvh - 220px)` height, so on a phone the folder tree consumed the whole viewport and the note pane was unreachable. It now mirrors the Brain Notes list/detail pattern: a single column on mobile that hides the tree once a note is opened (with a back control to return) and shows both panes from `md+`, laid out on a `grid` that fills its flex parent (`min-h-0`) rather than the fixed viewport-offset height, so a wrapped header no longer clips it.
## Security
diff --git a/client/src/components/wiki/tabs/BrowseTab.jsx b/client/src/components/wiki/tabs/BrowseTab.jsx
index 98242ec2a2..f20668e99b 100644
--- a/client/src/components/wiki/tabs/BrowseTab.jsx
+++ b/client/src/components/wiki/tabs/BrowseTab.jsx
@@ -95,9 +95,13 @@ export default function BrowseTab({ vaultId, notes, rawNotes, allNotes, onRefres
: [];
return (
- <div className="flex -m-4" style={{ height: 'calc(100dvh - 220px)' }}>
- {/* Left panel */}
- <div className="w-80 border-r border-port-border flex flex-col shrink-0">
+ // Responsive list/detail: single column on mobile (tree hides once a note is
+ // opened; the detail pane's back button restores it), both panes from md+.
+ // Fills its flex parent (min-h-0) rather than a fixed calc() so a wrapped
+ // header never clips it.
+ <div className="grid grid-cols-1 md:grid-cols-[320px_1fr] grid-rows-1 h-full min-h-0 overflow-hidden">
+ {/* Left panel — tree/list. Hidden on mobile while a note is open. */}
+ <div className={`border-r border-port-border flex-col min-h-0 overflow-hidden ${selectedNote || loadingNote ? 'hidden md:flex' : 'flex'}`}>
{/* Section toggle */}
<div className="p-3 border-b border-port-border flex items-center gap-2">
<button
@@ -194,8 +198,8 @@ export default function BrowseTab({ vaultId, notes, rawNotes, allNotes, onRefres
</div>
</div>
- {/* Right panel: note viewer */}
- <div className="flex-1 flex flex-col min-w-0">
+ {/* Right panel: note viewer. Hidden on mobile until a note is opened. */}
+ <div className={`flex-col min-w-0 min-h-0 overflow-hidden ${selectedNote || loadingNote ? 'flex' : 'hidden md:flex'}`}>
{loadingNote ? (
<div className="flex items-center justify-center h-full">
<BrailleSpinner text="Loading" />
@@ -204,6 +208,13 @@ export default function BrowseTab({ vaultId, notes, rawNotes, allNotes, onRefres
<>
{/* Note header */}
<div className="px-4 py-3 border-b border-port-border flex items-center gap-3">
+ <button
+ onClick={() => setSelectedNote(null)}
+ aria-label="Back to list"
+ className="p-1 rounded hover:bg-port-card text-gray-400 hover:text-white md:hidden"
+ >
+ <ArrowLeft size={16} />
+ </button>
<div className="flex-1 min-w-0">
<h2 className="text-white font-medium truncate">{selectedNote.name}</h2>
<div className="flex items-center gap-3 text-xs text-gray-500">
@@ -266,7 +277,7 @@ export default function BrowseTab({ vaultId, notes, rawNotes, allNotes, onRefres
)}
{/* Note content */}
- <div className="flex-1 overflow-auto flex">
+ <div className="flex-1 min-h-0 overflow-auto flex">
<div className="flex-1 min-w-0">
{editing ? (
<textarea
diff --git a/client/src/components/wiki/tabs/BrowseTab.test.jsx b/client/src/components/wiki/tabs/BrowseTab.test.jsx
new file mode 100644
index 0000000000..24018a7410
--- /dev/null
+++ b/client/src/components/wiki/tabs/BrowseTab.test.jsx
@@ -0,0 +1,68 @@
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import { MemoryRouter } from 'react-router-dom';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import BrowseTab from './BrowseTab';
+import * as api from '../../../services/api';
+
+vi.mock('../../../services/api');
+
+const sampleNote = {
+ path: 'wiki/sources/example.md',
+ name: 'Example Source',
+ folder: 'wiki/sources',
+ content: '# Example Source\n\nBody text.',
+ body: 'Body text.',
+ size: 42,
+ modifiedAt: new Date().toISOString(),
+ frontmatter: {},
+ tags: [],
+ wikilinks: [],
+ backlinks: [],
+};
+
+const notes = [
+ { path: 'wiki/sources/example.md', name: 'Example Source', folder: 'wiki/sources' },
+];
+
+function renderTab() {
+ return render(
+ <MemoryRouter>
+ <BrowseTab vaultId="v1" notes={notes} rawNotes={[]} allNotes={notes} onRefresh={() => {}} />
+ </MemoryRouter>
+ );
+}
+
+describe('BrowseTab responsive list/detail', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ api.getNote.mockResolvedValue(sampleNote);
+ });
+
+ it('uses a responsive grid parent instead of a fixed calc() height', () => {
+ const { container } = renderTab();
+ const root = container.firstChild;
+ expect(root.className).toContain('grid-cols-1');
+ expect(root.className).toContain('md:grid-cols-[320px_1fr]');
+ expect(root.className).toContain('min-h-0');
+ // No magic viewport-offset height anymore.
+ expect(container.innerHTML).not.toContain('calc(100dvh');
+ });
+
+ it('shows the empty detail placeholder before a note is selected', () => {
+ renderTab();
+ expect(screen.getByText('Select a page to view')).toBeInTheDocument();
+ });
+
+ it('selecting a note loads it and exposes a mobile back control that clears selection', async () => {
+ renderTab();
+ fireEvent.click(screen.getByText('Example Source'));
+ await waitFor(() => expect(api.getNote).toHaveBeenCalledWith('v1', 'wiki/sources/example.md'));
+
+ const back = await screen.findByLabelText('Back to list');
+ // Back control is mobile-only (hidden from md+).
+ expect(back.className).toContain('md:hidden');
+
+ fireEvent.click(back);
+ await waitFor(() => expect(screen.getByText('Select a page to view')).toBeInTheDocument());
+ });
+});
diff --git a/client/src/pages/Wiki.jsx b/client/src/pages/Wiki.jsx
index ea6d0331e7..52f9db6c52 100644
--- a/client/src/pages/Wiki.jsx
+++ b/client/src/pages/Wiki.jsx
@@ -186,8 +186,9 @@ export default function Wiki() {
<TabPills tabs={TABS} activeTab={activeTab} onChange={(id) => navigate({ pathname: `/wiki/${id}`, search: searchParams.toString() })} ariaLabel="Wiki sections" />
- {/* Tab content */}
- <div className="flex-1 overflow-auto p-4">
+ {/* Tab content — Browse manages its own list/detail scroll, so it gets a
+ bare flex-fill parent (no padding/scroll) instead of the padded scroller. */}
+ <div className={activeTab === 'browse' ? 'flex-1 min-h-0 flex' : 'flex-1 overflow-auto p-4'}>
{renderTabContent()}
</div>
</div>