Skip to content

Commit

Permalink
chore: Temp, playing with mounting of editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Jun 19, 2024
1 parent af046a6 commit 59cbbc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/code-editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default function CodeEditor(props) {
const [_, setEditor] = useState(null);

useEffect(() => {
if (editor.current && (!props.baseExampleSlug || !props.value)) return;
console.log('editor code:\n', props.value);
if (editor.current && !props.baseExampleSlug) return;
if (editor.current) editor.current.destroy();

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

setEditor(editor.current);
}, [props.value, props.baseExampleSlug]);
}, [props.baseExampleSlug]);

useEffect(() => (
() => {
Expand Down

0 comments on commit 59cbbc0

Please sign in to comment.