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) { getName(team?: Team) {
return team ? team.name : '' 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>) => { handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const name = event.target.value const name = event.target.value
this.setState({name}) this.setState({name})

View File

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

View File

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