@@ -400,7 +400,6 @@ const InviteFlyout: React.FC<InviteFlyoutProps> = ({
400
400
</ EuiFlyout >
401
401
)
402
402
}
403
-
404
403
const FlyOut : React . FC < FlyOutProps > = ( {
405
404
setisEditTeamMemberFlyoutVisible,
406
405
selectedMember,
@@ -410,6 +409,8 @@ const FlyOut: React.FC<FlyOutProps> = ({
410
409
const simpleFlyoutTitleId = useGeneratedHtmlId ( {
411
410
prefix : 'simpleFlyoutTitle'
412
411
} )
412
+ const { toast } = useToastStore ( )
413
+
413
414
const { form, errors, submit, loading, setValue } = useForm < FormInput > ( {
414
415
defaultValues : {
415
416
firstName : selectedMember . firstName ,
@@ -426,8 +427,6 @@ const FlyOut: React.FC<FlyOutProps> = ({
426
427
}
427
428
} )
428
429
429
- const { toast } = useToastStore ( )
430
-
431
430
return (
432
431
< EuiFlyout
433
432
ownFocus
@@ -517,7 +516,7 @@ const FlyOut: React.FC<FlyOutProps> = ({
517
516
}
518
517
519
518
export const TeamMembers : FunctionComponent < ProfileProps > = ( ) => {
520
- const { toast } = useToastStore ( )
519
+ const { toast, toasts , removeAllToast } = useToastStore ( )
521
520
const { getAdminUsers, removeUser, getAdminRoles, updateUserRoles } =
522
521
useAdminUsersStore ( )
523
522
const [ teamMembers , setTeamMembers ] = useState < TeamMemberProps [ ] > ( [ ] )
@@ -678,6 +677,11 @@ export const TeamMembers: FunctionComponent<ProfileProps> = () => {
678
677
}
679
678
680
679
if ( isOwner ( item ) ) {
680
+ if ( toasts . length ) {
681
+ removeAllToast ( )
682
+ toast ( undefined , "Owner role can't be changed" , 'danger' )
683
+ return
684
+ }
681
685
toast ( undefined , "Owner role can't be changed" , 'danger' )
682
686
return
683
687
}
@@ -715,6 +719,11 @@ export const TeamMembers: FunctionComponent<ProfileProps> = () => {
715
719
}
716
720
717
721
if ( isOwner ( item ) ) {
722
+ if ( toasts . length ) {
723
+ removeAllToast ( )
724
+ toast ( undefined , "Can't remove Owner" , 'danger' )
725
+ return
726
+ }
718
727
toast ( undefined , "Can't remove Owner" , 'danger' )
719
728
return
720
729
}
@@ -726,7 +735,7 @@ export const TeamMembers: FunctionComponent<ProfileProps> = () => {
726
735
]
727
736
}
728
737
]
729
- } , [ roles ] )
738
+ } , [ roles , toasts ] )
730
739
731
740
let removeMemberModal
732
741
0 commit comments