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

@@ -1,6 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import { fromJS, Seq } from "immutable"
import { fromJS, Seq, Iterable } from "immutable"
import { getSampleSchema } from "core/utils"
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
@@ -41,7 +41,7 @@ export default class Response extends React.Component {
static propTypes = {
code: PropTypes.string.isRequired,
response: PropTypes.object,
response: PropTypes.instanceOf(Iterable),
className: PropTypes.string,
getComponent: PropTypes.func.isRequired,
specSelectors: PropTypes.object.isRequired,
@@ -53,6 +53,12 @@ export default class Response extends React.Component {
response: fromJS({}),
};
shouldComponentUpdate(nextProps) {
return this.props.code !== nextProps.code
|| this.props.response !== nextProps.response
|| this.props.className !== nextProps.className
}
render() {
let {
code,