Teams are now refreshed properly when TeamListItems change
This commit is contained in:
		
							parent
							
								
									7a31cb0f6a
								
							
						
					
					
						commit
						9f12ccf5c1
					
				
					 3 changed files with 8 additions and 4 deletions
				
			
		|  | @ -24,12 +24,15 @@ export default function TeamList(props) { | ||||||
|   return (<div> |   return (<div> | ||||||
|     <ul className="border px-2 mb-2 rounded divide-y divide-gray-200"> |     <ul className="border px-2 mb-2 rounded divide-y divide-gray-200"> | ||||||
|       {props.teams.map( |       {props.teams.map( | ||||||
|         (team: any) => <TeamListItem key={team.id} team={team} onActionSelect={ |         (team: any) => <TeamListItem onChange={props.onChange} key={team.id} team={team} onActionSelect={ | ||||||
|           (action: string) => selectAction(action, team) |           (action: string) => selectAction(action, team) | ||||||
|         }></TeamListItem> |         }></TeamListItem> | ||||||
|       )} |       )} | ||||||
|     </ul> |     </ul> | ||||||
|     {showEditTeamModal && <EditTeamModal team={team} onExit={() => setShowEditTeamModal(false)}></EditTeamModal>} |     {showEditTeamModal && <EditTeamModal team={team} onExit={() => { | ||||||
|  |       props.onChange(); | ||||||
|  |       setShowEditTeamModal(false); | ||||||
|  |     }}></EditTeamModal>} | ||||||
|     {showMemberInvitationModal && |     {showMemberInvitationModal && | ||||||
|       <MemberInvitationModal |       <MemberInvitationModal | ||||||
|         team={team} |         team={team} | ||||||
|  |  | ||||||
|  | @ -18,6 +18,7 @@ export default function TeamListItem(props) { | ||||||
|   }).then( () => { |   }).then( () => { | ||||||
|     // success
 |     // success
 | ||||||
|     setTeam(null); |     setTeam(null); | ||||||
|  |     props.onChange(); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   return (team && <li className="mb-2 mt-2 divide-y"> |   return (team && <li className="mb-2 mt-2 divide-y"> | ||||||
|  |  | ||||||
|  | @ -72,14 +72,14 @@ export default function Teams(props) { | ||||||
|             </div> |             </div> | ||||||
|             <div> |             <div> | ||||||
|               {!!teams.length && |               {!!teams.length && | ||||||
|                 <TeamList teams={teams}> |                 <TeamList teams={teams} onChange={loadTeams}> | ||||||
|                 </TeamList> |                 </TeamList> | ||||||
|               } |               } | ||||||
| 
 | 
 | ||||||
|               {!!invites.length && <div> |               {!!invites.length && <div> | ||||||
|                 <h2 className="text-lg leading-6 font-medium text-gray-900">Open Invitations</h2> |                 <h2 className="text-lg leading-6 font-medium text-gray-900">Open Invitations</h2> | ||||||
|                 <ul className="border px-2 rounded mt-2 mb-2 divide-y divide-gray-200"> |                 <ul className="border px-2 rounded mt-2 mb-2 divide-y divide-gray-200"> | ||||||
|                   {invites.map( (team) => <TeamListItem key={team.id} team={team}></TeamListItem>)} |                   {invites.map( (team) => <TeamListItem onChange={loadTeams} key={team.id} team={team}></TeamListItem>)} | ||||||
|                 </ul> |                 </ul> | ||||||
|               </div>} |               </div>} | ||||||
|             </div> |             </div> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Alex van Andel
						Alex van Andel