diff options
author | Phil Hughes <me@iamphill.com> | 2018-05-09 10:55:37 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-05-09 10:55:37 +0100 |
commit | cc0663140fb2d54f7f9962c9c27c82e2eb5116df (patch) | |
tree | 87c4cc18720b522434188a161ea186bead538bb8 | |
parent | 9a54cb3601d5f581c92a46c2e9a0c0583a3475e0 (diff) | |
download | gitlab-ce-cc0663140fb2d54f7f9962c9c27c82e2eb5116df.tar.gz |
Fixed empty editors in the IDE
Closes #46153
-rw-r--r-- | app/assets/javascripts/ide/lib/common/model.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/lib/common/model.js b/app/assets/javascripts/ide/lib/common/model.js index 016dcda1fa1..b1e43a1e38c 100644 --- a/app/assets/javascripts/ide/lib/common/model.js +++ b/app/assets/javascripts/ide/lib/common/model.js @@ -14,12 +14,12 @@ export default class Model { (this.originalModel = this.monaco.editor.createModel( head ? head.content : this.file.raw, undefined, - new this.monaco.Uri(null, null, `original/${this.file.key}`), + new this.monaco.Uri(null, null, `original/${this.path}`), )), (this.model = this.monaco.editor.createModel( this.content, undefined, - new this.monaco.Uri(null, null, this.file.key), + new this.monaco.Uri(null, null, this.path), )), ); if (this.file.mrChange) { @@ -27,7 +27,7 @@ export default class Model { (this.baseModel = this.monaco.editor.createModel( this.file.baseRaw, undefined, - new this.monaco.Uri(null, null, `target/${this.file.path}`), + new this.monaco.Uri(null, null, `target/${this.path}`), )), ); } diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 3ac9b9222ca..b6baa693104 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -196,6 +196,8 @@ export const unstageChange = ({ commit }, path) => { }; export const openPendingTab = ({ commit, getters, dispatch, state }, { file, keyPrefix }) => { + if (getters.activeFile && getters.activeFile.key === `${keyPrefix}-${file.key}`) return false; + state.openFiles.forEach(f => eventHub.$emit(`editor.update.model.dispose.${f.key}`)); commit(types.ADD_PENDING_TAB, { file, keyPrefix }); |