Fix updating "MultiSelectListPreference" with non-existing selected values

This commit is contained in:
schroda
2026-06-08 16:27:23 +02:00
parent ea1b048c38
commit 55b597c44e
2 changed files with 13 additions and 8 deletions

View File

@@ -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 - (**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 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 - (**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 ## [20260509.01] (r3147) - 2026-05-09

View File

@@ -120,16 +120,20 @@ export function MultiSelectListPreference(props: MultiSelectListPreferenceProps)
}, [currentValue]); }, [currentValue]);
const findEntriesOf = (values?: string[] | null) => const findEntriesOf = (values?: string[] | null) =>
values?.map((value) => { values
const idx = entryValues.indexOf(value); ?.map((value) => {
return entries[idx]; const idx = entryValues.indexOf(value);
}) ?? []; return entries[idx];
})
.filter((value) => typeof value === 'string') ?? [];
const findEntryValuesOf = (values?: string[] | null) => const findEntryValuesOf = (values?: string[] | null) =>
values?.map((value) => { values
const idx = entries.indexOf(value); ?.map((value) => {
return entryValues[idx]; const idx = entries.indexOf(value);
}) ?? []; return entryValues[idx];
})
.filter((value) => typeof value === 'string') ?? [];
const getSummary = () => summary; const getSummary = () => summary;