@@ -656,10 +656,22 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
656656 if ( this . defaultPeople ) {
657657 people = this . defaultPeople ;
658658 } else {
659- if ( this . type === PersonType . Person || this . type === PersonType . Any ) {
659+ if ( this . groupId ) {
660+ if ( this . _groupPeople === null ) {
661+ try {
662+ this . _groupPeople = await getPeopleFromGroup ( graph , this . groupId ) ;
663+ } catch ( _ ) {
664+ this . _groupPeople = [ ] ;
665+ }
666+ }
667+ people = this . _groupPeople || [ ] ;
668+ } else if ( this . type === PersonType . Person || this . type === PersonType . Any ) {
660669 people = await getPeople ( graph ) ;
661- this . defaultPeople = people ;
670+ } else if ( this . type === PersonType . Group ) {
671+ const groups = ( await findGroups ( graph , '' , this . showMax , GroupType . Any ) ) || [ ] ;
672+ people = groups ;
662673 }
674+ this . defaultPeople = people ;
663675 }
664676 this . _showLoading = false ;
665677 }
@@ -671,18 +683,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
671683 this . requestUpdate ( ) ;
672684 this . fireCustomEvent ( 'selectionChanged' , this . selectedPeople ) ;
673685 }
674-
675- if ( this . groupId ) {
676- if ( this . _groupPeople === null ) {
677- try {
678- this . _groupPeople = await getPeopleFromGroup ( graph , this . groupId ) ;
679- } catch ( _ ) {
680- this . _groupPeople = [ ] ;
681- }
682- }
683-
684- people = this . _groupPeople || [ ] ;
685- } else if ( ! this . groupId && input ) {
686+ if ( input ) {
686687 people = [ ] ;
687688 if ( this . type === PersonType . Person || this . type === PersonType . Any ) {
688689 try {
@@ -718,16 +719,6 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
718719 }
719720 }
720721 }
721- // default group search without user input
722- if ( input . length === 0 && this . type === PersonType . Group ) {
723- people = [ ] ;
724- try {
725- const groups = ( await findGroups ( graph , '' , this . showMax , GroupType . Any ) ) || [ ] ;
726- people = people . concat ( groups ) ;
727- } catch ( e ) {
728- // nop
729- }
730- }
731722 }
732723
733724 if ( people ) {
0 commit comments