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

@@ -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;