From 638527e3d76ce7a7cc726602c1db0396381e62e8 Mon Sep 17 00:00:00 2001 From: AJIXuMuK Date: Sun, 8 Nov 2020 17:27:00 -0800 Subject: [PATCH] fix of #722 --- src/controls/listItemPicker/ListItemPicker.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controls/listItemPicker/ListItemPicker.tsx b/src/controls/listItemPicker/ListItemPicker.tsx index f44156288..bbcf84c65 100644 --- a/src/controls/listItemPicker/ListItemPicker.tsx +++ b/src/controls/listItemPicker/ListItemPicker.tsx @@ -87,11 +87,13 @@ export class ListItemPicker extends React.Component { let resolvedSugestions: { key: string; name: string }[] = await this.loadListItems(filterText); + const selectedItems = [...this.selectedItems, ...(this.props.defaultSelectedItems || [])]; + // Filter out the already retrieved items, so that they cannot be selected again - if (this.selectedItems && this.selectedItems.length > 0) { + if (selectedItems && selectedItems.length > 0) { let filteredSuggestions = []; for (const suggestion of resolvedSugestions) { - const exists = this.selectedItems.filter(sItem => sItem.key === suggestion.key); + const exists = selectedItems.filter(sItem => sItem.key === suggestion.key); if (!exists || exists.length === 0) { filteredSuggestions.push(suggestion); }