check editor existence in 'removeEditor' function

This commit is contained in:
Suren Atoyan 2019-10-03 12:51:22 +04:00
parent 509ea798da
commit e61d021e5e
2 changed files with 2 additions and 2 deletions

View File

@ -102,7 +102,7 @@ const DiffEditor =
!isMonacoMounting && !isEditorReady && createEditor();
}, [isMonacoMounting, isEditorReady, createEditor]);
const removeEditor = _ => editorRef.current.dispose();
const removeEditor = _ => editorRef.current && editorRef.current.dispose();
return (
<section style={{ ...styles.wrapper, width, height }}>

View File

@ -76,7 +76,7 @@ const Editor =
!isMonacoMounting && !isEditorReady && createEditor();
}, [isMonacoMounting, isEditorReady, createEditor]);
const removeEditor = _ => editorRef.current.dispose();
const removeEditor = _ => editorRef.current && editorRef.current.dispose();
return (
<section style={{ ...styles.wrapper, width, height }}>