-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add resolveDelay Property to PeoplePicker #143
Comments
Set The page may have no responding if I search for one character only. Looks like we need to find more way to improve the proformance By the way, we can limit the length of text to be used in filtering by private _filterPersons(filterText: string): IPersonaProps[] {
if (filterText.length < this.props.minFilterTextLength) {
return [];
}
return this.state.peoplePersonaMenu.filter(item =>
this._doesTextStartWith(item.text as string, filterText)
|| this._doesTextContains(item.text as string, filterText)
|| this._doesTextStartWith(item.secondaryText as string, filterText)
|| this._doesTextContains(item.secondaryText as string, filterText));
}
I will try limiting the number of the result, see if it helps. |
Looks like limiting the number of suggestions helps. Perhaps the people picker could not handle too many suggestions. Here is the code I tried: /**
* Filter persons based on Name and Email (starting with and contains)
*
* @param filterText
*/
private _filterPersons(filterText: string): IPersonaProps[] {
let result: IPersonaProps[] = [];
let suggestionLimit = this.props.suggestionLimit ? this.props.suggestionLimit : 5;
for (let i: number = 0; i < this.state.peoplePersonaMenu.length; i++) {
let item = this.state.peoplePersonaMenu[i];
if (this._doesTextStartWith(item.text as string, filterText)
|| this._doesTextContains(item.text as string, filterText)
|| this._doesTextStartWith(item.secondaryText as string, filterText)
|| this._doesTextContains(item.secondaryText as string, filterText))
{
result.push(item);
if (result.length === suggestionLimit) {
break;
}
}
}
return result;
} |
@tsekityam , seems like above code is working because it is filtering/searching limiting to first 5 users. However this doesn't make the filter work properly as it should filter all users not 5. So, may be the above is not a right approach. Looking at the technical resolution, I suppose there are two other approaches we could try and see if resolveDelay property is not a fix. @tsekityam , could you give these a try. I don't have an environment to test so cannot validate.
|
The code in previous comment is for referencing only. I have created a pull request #145 for it.
I will try them all later today. |
Both of them fix the freezing, seems that the limitation is on rending too many suggestions. Anyway, we still need to add a new props By the way, private _onPersonFilterChanged = (filterText: string, currentPersonas: IPersonaProps[]): IPersonaProps[] => {
let limitResults = this.props.limitResults;
if (filterText) {
let filteredPersonas: IPersonaProps[] = this._filterPersons(filterText);
filteredPersonas = this._removeDuplicates(filteredPersonas, currentPersonas);
filteredPersonas = limitResults ? filteredPersonas.splice(0, limitResults) : filteredPersonas;
return filteredPersonas;
} else {
return [];
}
} |
@tsekityam , great, thanks for checking it. Yes, adding the property Yeah, |
@AsishP , agree. Let me revise my PR... |
Thanks @tsekityam and @AsishP. I have merged the PR + updated the property to A new beta has been released, if you want to test it out @Arknev to verify the fix. You can follow these steps in order to install a beta version: https://sharepoint.github.io/sp-dev-fx-controls-react/beta/ |
This is now available in version |
Yes, this works great. One 'npm update', added new property (suggestionsLimit), bundled, and pushed to our site collection. Everything is working smoothly. Thanks! |
Originally posted by @Arknev in #117 (comment)
The UI freezes when searching for users. In our tenant we have millions of users. It would be great if the "resolveDelay" property (IBasePickerProps) could be set when calling the PeoplePicker. I don't see a way to delay search until a minimum number of characters are entered, which would be best, but this time delay would likely meet our needs.
The text was updated successfully, but these errors were encountered: