Skip to content

Commit 591e090

Browse files
committed
Bugfix: Brief column-width slider doesn't enable in settings window
`ListingSection`'s `sliderDisabled` $derived was reading `getBriefColumnWidthMode()` from `reactive-settings.svelte.ts`. That module is initialised only in `(main)/+layout.svelte`, so the settings window's own JS context holds a stale default value — the cross-window settings sync updates the main window's `briefColumnWidthMode` (so the columns reflow) but the settings window's slider stays disabled. Switched to the in-window subscription pattern other settings components already use: read the value via `getSetting()` on mount, then update a local `$state` via `onSpecificSettingChange`.
1 parent e18bdbf commit 591e090

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

apps/desktop/src/lib/settings/sections/ListingSection.svelte

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import SettingSwitch from '../components/SettingSwitch.svelte'
66
import SettingRadioGroup from '../components/SettingRadioGroup.svelte'
77
import SettingSlider from '../components/SettingSlider.svelte'
8-
import { getSettingDefinition } from '$lib/settings'
8+
import { getSetting, getSettingDefinition, onSpecificSettingChange, type BriefColumnWidthMode } from '$lib/settings'
99
import { createShouldShow } from '$lib/settings/settings-search'
10-
import { getBriefColumnWidthMode } from '$lib/settings/reactive-settings.svelte'
10+
import { onMount } from 'svelte'
1111
1212
interface Props {
1313
searchQuery: string
@@ -27,7 +27,16 @@
2727
const stripedRowsDef = getSettingDefinition('listing.stripedRows') ?? { label: '', description: '' }
2828
const briefWidthModeDef = getSettingDefinition('listing.briefColumnWidthMode') ?? { label: '', description: '' }
2929
30-
const sliderDisabled = $derived(getBriefColumnWidthMode() !== 'limited')
30+
// Read the setting directly and subscribe in-window. `reactive-settings.svelte.ts` is only
31+
// initialised in the main window — the settings window has its own JS context where that
32+
// module-scope state never updates, so we can't rely on its getter here.
33+
let briefWidthMode = $state<BriefColumnWidthMode>(getSetting('listing.briefColumnWidthMode'))
34+
onMount(() =>
35+
onSpecificSettingChange('listing.briefColumnWidthMode', (_id, value) => {
36+
briefWidthMode = value as BriefColumnWidthMode
37+
}),
38+
)
39+
const sliderDisabled = $derived(briefWidthMode !== 'limited')
3140
</script>
3241

3342
<SettingsSection title="Listing">

0 commit comments

Comments
 (0)