Skip to content

Commit dba2a32

Browse files
authored
Merge pull request #1516 from swagger-api/feature/fix-unstable-markers
Fix unstable marker issues.
2 parents 4c7b4b9 + 8e4952e commit dba2a32

File tree

5 files changed

+190
-171
lines changed

5 files changed

+190
-171
lines changed

src/layout.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export default class EditorLayout extends React.Component {
1313
layoutActions: PropTypes.object.isRequired
1414
}
1515

16+
onChange = (newYaml) => {
17+
this.props.specActions.updateSpec(newYaml)
18+
}
19+
1620
render() {
1721
let { getComponent } = this.props
1822

@@ -26,7 +30,9 @@ export default class EditorLayout extends React.Component {
2630
<div>
2731
<Container className='container'>
2832
<SplitPaneMode>
29-
<EditorContainer/>
33+
<EditorContainer
34+
onChange={this.onChange}
35+
/>
3036
<UIBaseLayout/>
3137
</SplitPaneMode>
3238
</Container>

src/plugins/editor/components/editor-container.jsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
import React from "react"
22
import PropTypes from "prop-types"
3-
import debounce from "lodash/debounce"
4-
5-
6-
const DEBOUNCE_TIME = 800 // 0.5 imperial seconds™
73

84
export default class EditorContainer extends React.Component {
95

10-
constructor(props, context) {
11-
super(props, context)
12-
this.onChange = debounce(this._onChange.bind(this), DEBOUNCE_TIME)
13-
}
14-
15-
_onChange(value) {
16-
if(typeof this.props.onChange === "function") {
17-
this.props.onChange(value)
18-
}
19-
this.props.specActions.updateSpec(value)
6+
// This is already debounced by editor.jsx
7+
onChange = (value) => {
8+
this.props.onChange(value)
209
}
2110

2211
render() {

0 commit comments

Comments
 (0)