Skip to content

Commit

Permalink
fix of #722
Browse files Browse the repository at this point in the history
  • Loading branch information
AJIXuMuK committed Nov 9, 2020
1 parent b3880e4 commit 638527e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controls/listItemPicker/ListItemPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ export class ListItemPicker extends React.Component<IListItemPickerProps, IListI
private onFilterChanged = async (filterText: string, tagList: { key: string; name: string }[]) => {
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);
}
Expand Down

0 comments on commit 638527e

Please sign in to comment.