fix(desktop): mark the File Browser setting session-only in Simple mode

Simple mode shadows fileBrowserOpen, so a flip on this row lands in the
session reveal layer and never persists. Show the same Simple-mode note the
other shadowed Appearance rows carry, so the row doesn't promise a standing
default it can't keep.
This commit is contained in:
Hermes Agent
2026-09-25 10:03:17 -05:00
committed by brooklyn!
parent 70b5725989
commit 3e11956c15
2 changed files with 27 additions and 3 deletions

View File

@@ -432,6 +432,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
const embedAllowed = useStore($embedAllowed)
const composerPopoutGesturesEnabled = useStore($composerPopoutGesturesEnabled)
const fileBrowserOpen = useStore($fileBrowserOpen)
const fileBrowserShadowed = useStore($modeShadowed('fileBrowserOpen'))
const translucency = useStore($translucency)
const glassMode = translucency.mode === 'glass' && GLASS_SUPPORTED
const userBubbleTransparency = useStore($userBubbleTransparency)
@@ -927,11 +928,12 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
)}
{/* The same state as the titlebar toggle / ⌘J, which persists across
launches — so this is the file browser's standing default. */}
launches — so this is the file browser's standing default. Simple
mode shadows it; a flip there only lasts the session, so say so. */}
{show('window-layout') && (
<ToggleRow
checked={fileBrowserOpen}
description={a.fileBrowserDesc}
description={withModeNote(a.fileBrowserDesc, fileBrowserShadowed)}
id={settingElementId(ids.fileBrowser)}
label={a.fileBrowserTitle}
onChange={setFileBrowserOpen}

View File

@@ -3,6 +3,8 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it } from 'vitest'
import { en } from '@/i18n/en'
import { $interfaceMode } from '@/store/interface-mode'
import { $fileBrowserOpen, FILE_BROWSER_PANE_ID, setFileBrowserOpen, toggleFileBrowserOpen } from '@/store/layout'
import { $paneStates } from '@/store/panes'
@@ -14,7 +16,10 @@ import { AppearanceSettings } from './appearance-settings'
afterEach(() => {
cleanup()
act(() => setFileBrowserOpen(false))
act(() => {
$interfaceMode.set('advanced')
setFileBrowserOpen(false)
})
})
function fileBrowserSwitch() {
@@ -51,4 +56,21 @@ describe('File Browser setting', () => {
expect(toggle.getAttribute('aria-checked')).toBe('true')
})
it('says a flip is session-only while Simple mode decides the value', () => {
const note = en.interfaceMode.sessionNote
act(() => $interfaceMode.set('simple'))
const toggle = fileBrowserSwitch()
expect(screen.getByText(content => content.includes(note))).toBeTruthy()
// Simple shadows the preference: the click is a session reveal, not a new default.
fireEvent.click(toggle)
expect(toggle.getAttribute('aria-checked')).toBe('true')
act(() => $interfaceMode.set('advanced'))
expect(screen.queryByText(content => content.includes(note))).toBeNull()
expect(toggle.getAttribute('aria-checked')).toBe('false')
})
})