Fix react warnings

This commit is contained in:
Jerko Steiner 2019-10-31 23:06:31 -04:00
parent cef39b2edd
commit dbed11214d
3 changed files with 4 additions and 13 deletions

View File

@ -34,16 +34,6 @@ extends React.PureComponent<TeamEditorProps, TeamEditorState> {
getName(team?: Team) {
return team ? team.name : ''
}
componentWillReceiveProps(nextProps: TeamEditorProps) {
if (nextProps.type === 'update') {
const {team} = nextProps
if (team !== (this.props as UpdateTeamProps).team) {
this.setState({
name: this.getName(team),
})
}
}
}
handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const name = event.target.value
this.setState({name})

View File

@ -69,6 +69,7 @@ export class TeamManager extends React.PureComponent<TeamManagerProps> {
<PanelHeading>Edit Team: {team && team.name}</PanelHeading>
<PanelBlock isDisplay='block'>
{team && <TeamEditor
key={team.id}
type='update'
team={team}
onUpdateTeam={this.props.teamActions.update}

View File

@ -135,9 +135,9 @@ export class TeamUserList extends React.PureComponent<TeamUsersProps> {
async componentDidMount() {
await this.fetchUsersInTeam(this.props.team.id)
}
async componentWillReceiveProps(nextProps: TeamUsersProps) {
const {team} = nextProps
if (team.id !== this.props.team.id) {
componentDidUpdate(prevProps: Readonly<TeamUsersProps>) {
const {team} = this.props
if (team.id !== prevProps.team.id) {
this.fetchUsersInTeam(team.id)
}
}