Limit re-rendering of table row

pull/10616/head
Alex P 2018-07-09 15:31:23 -07:00
parent c7cbf96c6f
commit 1de1fc7542
1 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import React, {PureComponent} from 'react'
import React, {Component} from 'react'
import _ from 'lodash'
import Tags from 'src/shared/components/Tags'
@ -47,7 +47,20 @@ interface Props {
}
@ErrorHandling
export default class AllUsersTableRow extends PureComponent<Props> {
export default class AllUsersTableRow extends Component<Props> {
public shouldComponentUpdate(nextProps) {
if (
_.isEqual(
_.omit(nextProps.user, 'superAdmin'),
_.omit(this.props.user, 'superAdmin')
)
) {
return false
}
return true
}
public render() {
const {user, onRemoveFromOrganization, onAddToOrganization} = this.props