Skip to content

Commit 43ca72d

Browse files
committed
junk: tmp
1 parent 869e2ab commit 43ca72d

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/components/code-editor/index.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export default function CodeEditor(props) {
3333
const [_, setEditor] = useState(null);
3434

3535
useEffect(() => {
36-
if (editor.current && (!props.baseExampleSlug || !props.value)) return;
36+
console.log('editor code:\n', props.value);
37+
if (editor.current && !props.baseExampleSlug) return;
3738
if (editor.current) editor.current.destroy();
3839

3940
const theme = EditorView.theme({}, { dark: true });
@@ -66,7 +67,7 @@ export default function CodeEditor(props) {
6667
});
6768

6869
setEditor(editor.current);
69-
}, [props.value, props.baseExampleSlug]);
70+
}, [props.baseExampleSlug]);
7071

7172
useEffect(() => (
7273
() => {

src/components/controllers/repl/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function getExample(slug, list) {
7979
export class Repl extends Component {
8080
state = {
8181
loading: 'Loading REPL...',
82-
code: '',
82+
code: '// Loading...',
8383
exampleSlug: ''
8484
};
8585

@@ -189,8 +189,9 @@ export class Repl extends Component {
189189

190190
componentDidUpdate = debounce(500, () => {
191191
let { code } = this.state;
192-
if (code === repoListExample) code = '';
192+
if (code == '// Loading...') return;
193193
// Reset select when code is changed from example
194+
console.log('this.state.exampleSlug', !!this.state.exampleSlug)
194195
if (this.state.exampleSlug) {
195196
const example = getExample(this.state.exampleSlug, EXAMPLES);
196197
if (code !== example.code && this.state.exampleSlug !== '') {
@@ -234,7 +235,7 @@ export class Repl extends Component {
234235
}
235236

236237
render(_, { loading, code, error, exampleSlug, copied }) {
237-
if (loading) {
238+
if (loading || code == '// Loading...') {
238239
return (
239240
<ReplWrapper loading>
240241
<div class={style.loading}>

0 commit comments

Comments
 (0)