Skip to content

Commit 200b361

Browse files
committed
Recalculate example value when requestBody value changes
1 parent f44dfeb commit 200b361

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/plugins/oas3/components/request-body-editor.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export default class RequestBodyEditor extends PureComponent {
4848
}
4949
}
5050

51+
componentDidUpdate(prevProps) {
52+
if(this.props.requestBody !== prevProps.requestBody) {
53+
// force recalc of value if the request body definition has changed
54+
this.setValueToSample(this.props.mediaType)
55+
}
56+
}
57+
5158
setValueToSample = (explicitMediaType) => {
5259
this.onChange(this.sample(explicitMediaType))
5360
}

0 commit comments

Comments
 (0)