microsoft / powercat-creator-kit

This toolkit helps create well-designed Power App experiences on the web & mobile. It contains a component library; PCF controls and other utilities that increase developer productivity.
MIT License
296 stars 49 forks source link

People Picker - long delay before suggestions appear for some searches. #429

Open robwood-TTECDigital opened 8 months ago

robwood-TTECDigital commented 8 months ago

Hi PowerCAT team.

We are seeing some searches where the suggestion results have a long delay before the results are displayed. This is not caused by an OnSearch or Suggestions formula that is taking up all of this time.

We have pinpointed the following logic in the component that causes this.

https://github.com/microsoft/powercat-code-components/blob/0b03d06da555f8719a8c8b30bfd8f4a417c9f093/PeoplePicker/PeoplePicker/index.ts#L168https://github.com/microsoft/powercat-code-components/blob/0b03d06da555f8719a8c8b30bfd8f4a417c9f093/PeoplePicker/PeoplePicker/index.ts#L168

Basically, if the control initiates two searches and the second search returns the same set of results as the previous one, then it will trigger this 5 second timeout logic before the results are displayed. This is very easy to trigger; for instance if the first search is for "dav" and the second for "dave" and you have a small number of "Dave"s in your data source then it will trigger. Also it is very easy to trigger it for empty search results.

This behaviour is currently making the control appear very slow and unreliable. Based on the comments in the code, I understand the limitation in PCF where it does not fire a "changed" event here if the results don't change. If it's not possible to find an alternative strategy to workaround this, consumers of this control need to be made aware ideally with a strategy called out to avoid it (making sure something in the results changes every time). This is very surprising behaviour and the neither the docs and examples for this component make any mention of it.

AB#1480