Recalculate example value when requestBody value changes

This commit is contained in:
Kyle Shockey
2017-11-17 17:20:01 -08:00
parent f44dfebd2a
commit 200b361328

View File

@@ -48,6 +48,13 @@ export default class RequestBodyEditor extends PureComponent {
} }
} }
componentDidUpdate(prevProps) {
if(this.props.requestBody !== prevProps.requestBody) {
// force recalc of value if the request body definition has changed
this.setValueToSample(this.props.mediaType)
}
}
setValueToSample = (explicitMediaType) => { setValueToSample = (explicitMediaType) => {
this.onChange(this.sample(explicitMediaType)) this.onChange(this.sample(explicitMediaType))
} }