fix: use specPath prop to resolve operations in OperationContainer (#4272)
* Use `parameterWithMeta` to get parameter data in <ParameterRow> * Prefer specPath when fetching resolved subtrees in OperationContainer * Add test for OAS3 callback rendering * Remove debugger statement
This commit is contained in:
@@ -82,23 +82,23 @@ export default class OperationContainer extends PureComponent {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { path, method, specActions, specSelectors, response, isShown } = nextProps
|
||||
const resolvedSubtree = specSelectors.specResolvedSubtree(["paths", path, method])
|
||||
const { response, isShown } = nextProps
|
||||
const resolvedSubtree = this.getResolvedSubtree()
|
||||
|
||||
if(response !== this.props.response) {
|
||||
this.setState({ executeInProgress: false })
|
||||
}
|
||||
|
||||
if(isShown && resolvedSubtree === undefined) {
|
||||
specActions.requestResolvedSubtree(["paths", path, method])
|
||||
this.requestResolvedSubtree()
|
||||
}
|
||||
}
|
||||
|
||||
toggleShown =() => {
|
||||
let { layoutActions, specActions, tag, operationId, path, method, isShown } = this.props
|
||||
let { layoutActions, tag, operationId, isShown } = this.props
|
||||
if(!isShown) {
|
||||
// transitioning from collapsed to expanded
|
||||
specActions.requestResolvedSubtree(["paths", path, method])
|
||||
this.requestResolvedSubtree()
|
||||
}
|
||||
layoutActions.show(["operations", tag, operationId], !isShown)
|
||||
}
|
||||
@@ -117,6 +117,37 @@ export default class OperationContainer extends PureComponent {
|
||||
this.setState({ executeInProgress: true })
|
||||
}
|
||||
|
||||
getResolvedSubtree = () => {
|
||||
const {
|
||||
specSelectors,
|
||||
path,
|
||||
method,
|
||||
specPath
|
||||
} = this.props
|
||||
|
||||
if(specPath) {
|
||||
return specSelectors.specResolvedSubtree(specPath.toJS()) || Map()
|
||||
}
|
||||
|
||||
return specSelectors.specResolvedSubtree(["paths", path, method]) || Map()
|
||||
}
|
||||
|
||||
requestResolvedSubtree = () => {
|
||||
const {
|
||||
specActions,
|
||||
path,
|
||||
method,
|
||||
specPath
|
||||
} = this.props
|
||||
|
||||
|
||||
if(specPath) {
|
||||
return specActions.requestResolvedSubtree(specPath.toJS())
|
||||
}
|
||||
|
||||
return specActions.requestResolvedSubtree(["paths", path, method])
|
||||
}
|
||||
|
||||
render() {
|
||||
let {
|
||||
op: unresolvedOp,
|
||||
@@ -151,7 +182,7 @@ export default class OperationContainer extends PureComponent {
|
||||
|
||||
const Operation = getComponent( "operation" )
|
||||
|
||||
const resolvedSubtree = specSelectors.specResolvedSubtree(["paths", path, method]) || Map()
|
||||
const resolvedSubtree = this.getResolvedSubtree()
|
||||
|
||||
const operationProps = fromJS({
|
||||
op: resolvedSubtree || Map(),
|
||||
|
||||
Reference in New Issue
Block a user