Skip to content

Commit 869e2ab

Browse files
committed
refactor: Fix editor mount conditional
1 parent 5ad2412 commit 869e2ab

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/code-editor/index.jsx

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

3535
useEffect(() => {
36-
if (editor.current && !props.baseExampleSlug) return;
36+
if (editor.current && (!props.baseExampleSlug || !props.value)) return;
3737
if (editor.current) editor.current.destroy();
3838

3939
const theme = EditorView.theme({}, { dark: true });
@@ -66,7 +66,7 @@ export default function CodeEditor(props) {
6666
});
6767

6868
setEditor(editor.current);
69-
}, [props.baseExampleSlug]);
69+
}, [props.value, props.baseExampleSlug]);
7070

7171
useEffect(() => (
7272
() => {

0 commit comments

Comments
 (0)