microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
939 stars 298 forks source link

[BUG] people-picker: showMax has no effect with type = group and group-type != any #3288

Closed RedGlow closed 2 weeks ago

RedGlow commented 3 weeks ago

Describe the bug When an component is used with type=group and group-type different from "any", the show-max property is ignored.

I traced the reason to: https://github.com/microsoftgraph/microsoft-graph-toolkit/blob/3695be96044ee2187dad474b55a5e4c4ffd7682e/packages/mgt-components/src/graph/graph.groups.ts#L129

This branch of the code is encountered when a list of groups is requested and group-type is not any. In this branch, top is not used (this parameter derives from show-max), whereas in the other branch (used when group-type is "any"), the parameter is used.

If it's impossible to respect the "show-max" attribute in this case (since there's a batched call involved, and the implementation could get clunky), this corner case should be at least documented.

To Reproduce (using the react wrapper) create a component like this:

<PeoplePicker type={PersonType.group} groupType={GroupType.unified | GroupType.security | GroupType.mailenabledsecurity} showMax={4}/> Notice that the component shows lots of groups.

Change groupType to groupType={GroupType.any}

Now at most 4 groups are displayed.

Environment (please complete the following information):