@samitouri / QOS-React-2 / commits / 4440486a24

Properly clear live editor on JSX compile failure

Ben Alpert committed Jan 17, 2014 at 17:42 UTC 4440486a24ac0fb3bfe0c9181b849dc36237ed43
1 file changed +3 -6
docs/_js/live_editor.js
+3 -6
@@ -115,11 +115,9 @@ var ReactPlayground = React.createClass({
115 compiledCode = this.compileCode();
116 } catch (err) {}
117
118 - // we're creating both versions, to avoid the flicker when switching from
119 - // one view to another when CodeMirror recompiles
118 var jsContent =
119 <CodeMirrorEditor
122 - style={{display: isJS ? 'inherit' : 'none'}}
120 + key="js"
121 className="playgroundStage CodeMirror-readonly"
122 onChange={this.handleCodeChange}
123 codeText={compiledCode}
@@ -128,7 +126,7 @@ var ReactPlayground = React.createClass({
126
127 var jsxContent =
128 <CodeMirrorEditor
131 - style={{display: isJS ? 'none' : 'inherit'}}
129 + key="jsx"
130 onChange={this.handleCodeChange}
131 className="playgroundStage"
132 codeText={this.state.code}
@@ -154,8 +152,7 @@ var ReactPlayground = React.createClass({
152 </div>
153 </div>
154 <div className="playgroundCode">
157 - {jsxContent}
158 - {jsContent}
155 + {isJS ? jsContent : jsxContent}
156 </div>
157 <div className="playgroundPreview">
158 <div ref="mount" />