Add shouldComponentUpdate to response.jsx and live-response.jsx. Remove isShownKey from shouldComponentUpdate of OperationContainer. Moved response and request out to separate props for operation.jsx. Removed unused request prop from responses.jsx.

This commit is contained in:
Owen Conti
2017-08-20 18:50:49 -06:00
parent 017a26af1e
commit cfb4625eb0
5 changed files with 37 additions and 27 deletions

View File

@@ -6,6 +6,8 @@ import { Iterable } from "immutable"
export default class Operation extends PureComponent {
static propTypes = {
operation: PropTypes.instanceOf(Iterable).isRequired,
response: PropTypes.instanceOf(Iterable),
request: PropTypes.instanceOf(Iterable),
toggleShown: PropTypes.func.isRequired,
onTryoutClick: PropTypes.func.isRequired,
@@ -24,19 +26,21 @@ export default class Operation extends PureComponent {
}
static defaultProps = {
showSummary: true,
operation: null,
response: null,
allowTryItOut: true,
displayOperationId: false,
displayRequestDuration: false
request: null
}
shouldComponentUpdate(nextProps) {
return this.props.operation !== nextProps.operation
|| this.props.response !== nextProps.response
|| this.props.request !== nextProps.request
}
render() {
let {
response,
request,
toggleShown,
onTryoutClick,
onCancelClick,
@@ -67,8 +71,6 @@ export default class Operation extends PureComponent {
tryItOutEnabled,
executeInProgress
} = operationProps.toJS()
let response = operationProps.get("response")
let request = operationProps.get("request")
let {
summary,