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: keep the playground inventory collapsed when a model is auto-selected (#7232)
[._.]/ Adam Eivyc3298260d3fd
diff --git a/client/src/pages/LocalLlmPlayground.jsx b/client/src/pages/LocalLlmPlayground.jsxindex ad8014d886..63a7f936c9 100644--- a/client/src/pages/LocalLlmPlayground.jsx+++ b/client/src/pages/LocalLlmPlayground.jsx@@ -369,15 +369,20 @@ export default function LocalLlmPlayground() {setSelectedTargets([{ backend: installedTargets[0].backend, modelId: installedTargets[0].modelId }]);}, [installedTargets, selectedTargets.length]);- // With nothing selected — no installed models, a stale URL target that was- // dropped, or every compare target deselected — the run can't proceed, so the- // narrow disclosure opens on the model list (or on the "no models installed"- // message) instead of collapsing the prerequisite out of sight. `modelsOpen`- // is deliberately not a dependency: closing it by hand must not re-open it.+ // Nothing is selectable — the install has no local models, or none that pass+ // the hardware filter — so the narrow disclosure opens on that empty state+ // instead of collapsing the prerequisite out of sight.+ //+ // Gated on the INSTALLED list, not on the selection: with models present the+ // auto-select effect above fills an empty selection in the same flush, so+ // keying on the momentarily-empty selection would open the inventory on every+ // visit that carries no URL target and never close it again — which is the+ // regression this page is being fixed for. `modelsOpen` is deliberately not a+ // dependency: closing the empty state by hand must not re-open it.useEffect(() => {- if (loadingStatus || selectedTargets.length > 0) return;+ if (loadingStatus || installedTargets.length > 0) return;setModelsOpen(true);- }, [loadingStatus, selectedTargets.length]);+ }, [installedTargets.length, loadingStatus]);const selectedKeys = useMemo(() => new Set(selectedTargets.map(localLlmTargetKey)), [selectedTargets]);// `/api/ps` reports what's resident but not which model is mid-generation, sodiff --git a/client/src/pages/LocalLlmPlayground.test.jsx b/client/src/pages/LocalLlmPlayground.test.jsxindex ebdd24794c..91cfbbae3e 100644--- a/client/src/pages/LocalLlmPlayground.test.jsx+++ b/client/src/pages/LocalLlmPlayground.test.jsx@@ -17,8 +17,8 @@ vi.mock('../components/ui/Toast', () => ({import LocalLlmPlayground from './LocalLlmPlayground';import { getLoadedLlmModels, getLocalLlmCatalog, getLocalLlmStatus, streamLocalLlmTest } from '../services/api';-const renderPlayground = () => render(- <MemoryRouter initialEntries={['/local-llm/playground?backend=ollama&model=command-r-plus%3A104b']}>+const renderPlayground = (entry = '/local-llm/playground?backend=ollama&model=command-r-plus%3A104b') => render(+ <MemoryRouter initialEntries={[entry]}><LocalLlmPlayground /></MemoryRouter>,);@@ -95,6 +95,20 @@ describe('LocalLlmPlayground task order', () => {expect(run.compareDocumentPosition(advanced) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();});+ it('stays collapsed when the first model is auto-selected from a URL carrying no target', async () => {+ // The ⌘K / sidebar entry path: no backend+model params, so the selection is+ // empty on the render where loading finishes and the auto-select effect+ // fills it in the same flush. Keying the disclosure off that momentarily+ // empty selection would leave the inventory expanded here — the exact+ // above-the-fold regression being fixed.+ renderPlayground('/local-llm/playground');++ await waitFor(() => expect(modelsToggle().textContent).toContain('command-r-plus:104b'));+ expect(modelsToggle()).toHaveAttribute('aria-expanded', 'false');+ expect(modelsPanelCollapsed()).toBe(true);+ expect(screen.getByRole('button', { name: 'Run chat' }).disabled).toBe(false);+ });+it('keeps the selection and the prompt text across opening and closing the picker', async () => {renderPlayground();await waitFor(() => expect(screen.getAllByText('command-r-plus:104b').length).toBeGreaterThan(0));