fix(preferences): null-guard DropdownMenuRadioGroup handlers

Reka UI tightened model-value's type to AcceptableValue, which
includes null. The four inline (v: string) => ... handlers in
PreferencesRow.vue no longer satisfied the prop's expected signature,
breaking TS at the standalone-app build step (forum-app, others).

Drop the string annotation, guard the null case, and cast on the
forward call to preserve the intended narrowing.
This commit is contained in:
Padreug 2026-05-21 00:02:26 +02:00
commit 67dbfb16e1

View file

@ -52,7 +52,7 @@ function notImplemented() {
<DropdownMenuContent align="center" class="w-40"> <DropdownMenuContent align="center" class="w-40">
<DropdownMenuLabel>{{ t('common.nav.theme') }}</DropdownMenuLabel> <DropdownMenuLabel>{{ t('common.nav.theme') }}</DropdownMenuLabel>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuRadioGroup :model-value="theme" @update:model-value="(v: string) => setTheme(v as 'dark' | 'light' | 'system')"> <DropdownMenuRadioGroup :model-value="theme" @update:model-value="(v) => v != null && setTheme(v as 'dark' | 'light' | 'system')">
<DropdownMenuRadioItem value="light"><Sun class="w-4 h-4 mr-2" />{{ t('common.nav.themeLight') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="light"><Sun class="w-4 h-4 mr-2" />{{ t('common.nav.themeLight') }}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="dark"><Moon class="w-4 h-4 mr-2" />{{ t('common.nav.themeDark') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="dark"><Moon class="w-4 h-4 mr-2" />{{ t('common.nav.themeDark') }}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="system"><Monitor class="w-4 h-4 mr-2" />{{ t('common.nav.themeSystem') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="system"><Monitor class="w-4 h-4 mr-2" />{{ t('common.nav.themeSystem') }}</DropdownMenuRadioItem>
@ -71,7 +71,7 @@ function notImplemented() {
<DropdownMenuContent align="center" class="w-44"> <DropdownMenuContent align="center" class="w-44">
<DropdownMenuLabel>{{ t('common.nav.language') }}</DropdownMenuLabel> <DropdownMenuLabel>{{ t('common.nav.language') }}</DropdownMenuLabel>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuRadioGroup :model-value="currentLocale" @update:model-value="(v: string) => setLocale(v)"> <DropdownMenuRadioGroup :model-value="currentLocale" @update:model-value="(v) => v != null && setLocale(v as string)">
<DropdownMenuRadioItem v-for="l in locales" :key="l.code" :value="l.code"> <DropdownMenuRadioItem v-for="l in locales" :key="l.code" :value="l.code">
<span class="mr-2">{{ l.flag }}</span>{{ l.name }} <span class="mr-2">{{ l.flag }}</span>{{ l.name }}
</DropdownMenuRadioItem> </DropdownMenuRadioItem>
@ -106,7 +106,7 @@ function notImplemented() {
</button> </button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end" class="w-40"> <DropdownMenuContent align="end" class="w-40">
<DropdownMenuRadioGroup :model-value="theme" @update:model-value="(v: string) => setTheme(v as 'dark' | 'light' | 'system')"> <DropdownMenuRadioGroup :model-value="theme" @update:model-value="(v) => v != null && setTheme(v as 'dark' | 'light' | 'system')">
<DropdownMenuRadioItem value="light"><Sun class="w-4 h-4 mr-2" />{{ t('common.nav.themeLight') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="light"><Sun class="w-4 h-4 mr-2" />{{ t('common.nav.themeLight') }}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="dark"><Moon class="w-4 h-4 mr-2" />{{ t('common.nav.themeDark') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="dark"><Moon class="w-4 h-4 mr-2" />{{ t('common.nav.themeDark') }}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="system"><Monitor class="w-4 h-4 mr-2" />{{ t('common.nav.themeSystem') }}</DropdownMenuRadioItem> <DropdownMenuRadioItem value="system"><Monitor class="w-4 h-4 mr-2" />{{ t('common.nav.themeSystem') }}</DropdownMenuRadioItem>
@ -129,7 +129,7 @@ function notImplemented() {
</button> </button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end" class="w-44"> <DropdownMenuContent align="end" class="w-44">
<DropdownMenuRadioGroup :model-value="currentLocale" @update:model-value="(v: string) => setLocale(v)"> <DropdownMenuRadioGroup :model-value="currentLocale" @update:model-value="(v) => v != null && setLocale(v as string)">
<DropdownMenuRadioItem v-for="l in locales" :key="l.code" :value="l.code"> <DropdownMenuRadioItem v-for="l in locales" :key="l.code" :value="l.code">
<span class="mr-2">{{ l.flag }}</span>{{ l.name }} <span class="mr-2">{{ l.flag }}</span>{{ l.name }}
</DropdownMenuRadioItem> </DropdownMenuRadioItem>