Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(create): the Expert section stays open while the app runs

purplebfb79d170eb1
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index 341c0403..29c8c1fc 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -278,7 +278,7 @@ export function ParamGroups() {
{/* Only render a section with controls the selected backend can use. */}
{showExpert && (
- <Section title="Expert" icon={FlaskConical} defaultOpen={false}>
+ <Section title="Expert" icon={FlaskConical} open={s.expertOpen} onOpenChange={s.setExpertOpen}>
{/* Sampler/Scheduler are ComfyUI-only knobs — the hosted WaveSpeed
endpoints don't accept them, so hide them on the cloud backend
rather than let the user tune a control that's silently dropped. */}
diff --git a/src/components/create/experimental/__tests__/expert-stays-open.test.tsx b/src/components/create/experimental/__tests__/expert-stays-open.test.tsx
new file mode 100644
index 00000000..dfee9652
--- /dev/null
+++ b/src/components/create/experimental/__tests__/expert-stays-open.test.tsx
@@ -0,0 +1,57 @@
+// @vitest-environment jsdom
+/**
+ * The box, 03.10.2026: the Expert section of the advanced settings was folded
+ * shut again every time the panel was opened, so the LoRA stack was two
+ * clicks away each time. Whether it is open is remembered while the app runs
+ * (not across a restart: a fresh start shows the short panel).
+ */
+import { createElement } from 'react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { useCreateStore } from '../../../../stores/createStore'
+import { ParamGroups } from '../ParamGroups'
+
+vi.mock('../../../../api/mlx-image', () => ({ isMlxImageHost: () => false }))
+vi.mock('../CreateContext', () => ({
+ useCreateExp: () => ({
+ samplerList: ['euler'], schedulerList: ['simple'], loraList: [], vaeList: [], refreshModelLists: vi.fn(),
+ }),
+}))
+
+beforeEach(() => {
+ vi.stubGlobal('ResizeObserver', class { observe() {} unobserve() {} disconnect() {} })
+ useCreateStore.setState({ backend: 'local', expertOpen: false } as never)
+ useCreateStore.getState().setIntent('image')
+})
+afterEach(() => { cleanup(); vi.unstubAllGlobals() })
+
+describe('the Expert section of the advanced settings', () => {
+ it('starts folded', () => {
+ render(createElement(ParamGroups))
+ expect(screen.queryByText('Sampler')).toBeNull()
+ })
+
+ it('is still open when the panel is closed and opened again', () => {
+ const first = render(createElement(ParamGroups))
+ fireEvent.click(screen.getByText('Expert'))
+ expect(screen.getByText('Sampler')).toBeTruthy()
+ first.unmount()
+ render(createElement(ParamGroups))
+ expect(screen.getByText('Sampler')).toBeTruthy()
+ })
+
+ it('folds again when the user folds it, and stays folded', () => {
+ const first = render(createElement(ParamGroups))
+ fireEvent.click(screen.getByText('Expert'))
+ fireEvent.click(screen.getByText('Expert'))
+ first.unmount()
+ render(createElement(ParamGroups))
+ expect(screen.queryByText('Sampler')).toBeNull()
+ })
+
+ it('is not written to disk', () => {
+ useCreateStore.getState().setExpertOpen(true)
+ const saved = JSON.parse(localStorage.getItem(useCreateStore.persist.getOptions().name ?? '') ?? '{}')
+ expect(saved.state?.expertOpen).toBeUndefined()
+ })
+})
diff --git a/src/components/create/ui/Section.tsx b/src/components/create/ui/Section.tsx
index 34f5a6fa..5bd67ebc 100644
--- a/src/components/create/ui/Section.tsx
+++ b/src/components/create/ui/Section.tsx
@@ -12,13 +12,23 @@ interface Props {
help?: string
collapsible?: boolean
defaultOpen?: boolean
+ /** Given together: the caller keeps whether the section is open, so it can
+ * outlive the panel this section sits in. Without them the section keeps
+ * it itself and starts from `defaultOpen` on every mount. */
+ open?: boolean
+ onOpenChange?: (open: boolean) => void
right?: React.ReactNode
children: React.ReactNode
}
-export function Section({ title, icon: Icon, help, collapsible = true, defaultOpen = true, right, children }: Props) {
- const [open, setOpen] = useState(defaultOpen)
- const toggle = () => collapsible && setOpen((o) => !o)
+export function Section({ title, icon: Icon, help, collapsible = true, defaultOpen = true, open: heldOpen, onOpenChange, right, children }: Props) {
+ const [ownOpen, setOwnOpen] = useState(defaultOpen)
+ const open = heldOpen ?? ownOpen
+ const toggle = () => {
+ if (!collapsible) return
+ if (onOpenChange) onOpenChange(!open)
+ else setOwnOpen(!open)
+ }
return (
<div className="border-b border-white/[0.05] last:border-b-0">
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 64ba7085..67654cb3 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -356,6 +356,9 @@ interface CreateState {
/** Upscale target for the cloud super-resolution endpoint. */
targetResolution: '2k' | '4k' | '8k'
showNegative: boolean
+ /** Whether the Expert section of the advanced settings is unfolded. Kept
+ * here so it outlives the panel; this run of the app only, never saved. */
+ expertOpen: boolean
selectedLoras: { name: string; strength: number }[]
/** The last strength set for each LoRA file, kept while the LoRA is off, so
* ticking it again brings its own value back instead of the default. */
@@ -503,6 +506,7 @@ interface CreateState {
intent: () => CreateIntent
setIntent: (intent: CreateIntent) => void
toggleNegative: () => void
+ setExpertOpen: (open: boolean) => void
toggleLora: (name: string) => void
setLoraStrengthFor: (name: string, strength: number) => void
clearLoras: () => void
@@ -728,6 +732,7 @@ export const useCreateStore = create<CreateState>()(
musicHowtoSeen: false,
targetResolution: '4k' as '2k' | '4k' | '8k',
showNegative: false,
+ expertOpen: false,
selectedLoras: [] as { name: string; strength: number }[],
loraStrengths: {} as Record<string, number>,
selectedVae: 'auto',
@@ -941,6 +946,7 @@ export const useCreateStore = create<CreateState>()(
if (get().batchSources.length && (!get().source || !BATCH_INTENTS.has(intent))) get().setBatchSources([])
},
toggleNegative: () => set((s) => ({ showNegative: !s.showNegative })),
+ setExpertOpen: (expertOpen) => set({ expertOpen }),
toggleLora: (name) => set((s) => ({ selectedLoras: s.selectedLoras.some((l) => l.name === name) ? s.selectedLoras.filter((l) => l.name !== name) : [...s.selectedLoras, { name, strength: s.loraStrengths[name] ?? defaultLoraStrength(name) }] })),
setLoraStrengthFor: (name, strength) => set((s) => {
if (!Number.isFinite(strength)) return {}