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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user