Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/core/components/content-type.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
const noop = ()=>{}

export default class ContentType extends React.Component {

static propTypes = {
ariaControls: PropTypes.string,
contentTypes: PropTypes.oneOfType([ImPropTypes.list, ImPropTypes.set, ImPropTypes.seq]),
Expand All @@ -24,19 +23,22 @@
}

componentDidMount() {
// Needed to populate the form, initially
if(this.props.contentTypes) {
this.props.onChange(this.props.contentTypes.first())
// Populate the form initially
const { contentTypes, onChange } = this.props
if (contentTypes && contentTypes.size) {
onChange(contentTypes.first())
}
}

UNSAFE_componentWillReceiveProps(nextProps) {
if(!nextProps.contentTypes || !nextProps.contentTypes.size) {
componentDidUpdate(prevProps) {

Check failure on line 33 in src/core/components/content-type.jsx

View workflow job for this annotation

GitHub Actions / build

'prevProps' is defined but never used
const { contentTypes, value, onChange } = this.props

if (!contentTypes || !contentTypes.size) {
return
}

if(!nextProps.contentTypes.includes(nextProps.value)) {
nextProps.onChange(nextProps.contentTypes.first())
if (!contentTypes.includes(value)) {
onChange(contentTypes.first())
}
}

Expand All @@ -45,7 +47,7 @@
render() {
let { ariaControls, ariaLabel, className, contentTypes, controlId, value } = this.props

if ( !contentTypes || !contentTypes.size )
if (!contentTypes || !contentTypes.size)
return null

return (
Expand All @@ -58,4 +60,5 @@
</div>
)
}
}

}
12 changes: 6 additions & 6 deletions src/core/containers/OperationContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ export default class OperationContainer extends PureComponent {
}
}

UNSAFE_componentWillReceiveProps(nextProps) {
const { response, isShown } = nextProps
componentDidUpdate(prevProps) {
const { response, isShown } = this.props
const resolvedSubtree = this.getResolvedSubtree()

if(response !== this.props.response) {
if (response !== prevProps.response) {
this.setState({ executeInProgress: false })
}

if(isShown && resolvedSubtree === undefined) {
if (isShown && resolvedSubtree === undefined && !prevProps.isShown) {
this.requestResolvedSubtree()
}
}
Expand Down
Loading