Commit efb62337 authored by Eric Eastwood's avatar Eric Eastwood

Protect against uninitialized monacoInstance

parent 335d0b96
...@@ -29,14 +29,19 @@ const RepoEditor = { ...@@ -29,14 +29,19 @@ const RepoEditor = {
this.addMonacoEvents(); this.addMonacoEvents();
Helper.setMonacoModelFromLanguage(); this.setupEditor();
this.showHide();
}) })
.catch(Helper.loadingError); .catch(Helper.loadingError);
}, },
methods: { methods: {
setupEditor() {
this.showHide();
if (this.isTree) return;
Helper.setMonacoModelFromLanguage();
},
showHide() { showHide() {
if (!this.openedFiles.length || (this.binary && !this.activeFile.raw)) { if (!this.openedFiles.length || (this.binary && !this.activeFile.raw)) {
this.$el.style.display = 'none'; this.$el.style.display = 'none';
...@@ -109,10 +114,9 @@ const RepoEditor = { ...@@ -109,10 +114,9 @@ const RepoEditor = {
}, },
blobRaw() { blobRaw() {
this.showHide(); if (Helper.monacoInstance) {
this.setupEditor();
if (this.isTree) return; }
Helper.setMonacoModelFromLanguage();
}, },
}, },
}; };
......
...@@ -4,7 +4,7 @@ import Store from '../stores/repo_store'; ...@@ -4,7 +4,7 @@ import Store from '../stores/repo_store';
import '../../flash'; import '../../flash';
const RepoHelper = { const RepoHelper = {
monacoInstance: {}, monacoInstance: null,
getDefaultActiveFile() { getDefaultActiveFile() {
return { return {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment