From 55b597c44e8f827f79461f7332cb4e3d3394d858 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:27:23 +0200 Subject: [PATCH] Fix updating "MultiSelectListPreference" with non-existing selected values --- CHANGELOG.md | 1 + .../components/MultiSelectListPreference.tsx | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1407773e..de0fd474 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled - (**Manga/Library**) Fix mark as read/unread option not being disabled for manga without any chapters - (**Manga/Library**) Fix delete/download option not being disabled for manga without any chapters +- (**Source**) Fix changing configuration settings with multi option selection where a selected option does not exist anymore. (E.g. Komgas "Default libraries" setting, still having a library selected that has been deleted) ## [20260509.01] (r3147) - 2026-05-09 diff --git a/src/features/source/configuration/components/MultiSelectListPreference.tsx b/src/features/source/configuration/components/MultiSelectListPreference.tsx index 2be6deb9..23541350 100644 --- a/src/features/source/configuration/components/MultiSelectListPreference.tsx +++ b/src/features/source/configuration/components/MultiSelectListPreference.tsx @@ -120,16 +120,20 @@ export function MultiSelectListPreference(props: MultiSelectListPreferenceProps) }, [currentValue]); const findEntriesOf = (values?: string[] | null) => - values?.map((value) => { - const idx = entryValues.indexOf(value); - return entries[idx]; - }) ?? []; + values + ?.map((value) => { + const idx = entryValues.indexOf(value); + return entries[idx]; + }) + .filter((value) => typeof value === 'string') ?? []; const findEntryValuesOf = (values?: string[] | null) => - values?.map((value) => { - const idx = entries.indexOf(value); - return entryValues[idx]; - }) ?? []; + values + ?.map((value) => { + const idx = entries.indexOf(value); + return entryValues[idx]; + }) + .filter((value) => typeof value === 'string') ?? []; const getSummary = () => summary;