From 2aaa0222bfeb88699553a6c9dae48a642755259b Mon Sep 17 00:00:00 2001 From: Phil Hughes <me@iamphill.com> Date: Thu, 5 Apr 2018 19:41:07 +0100 Subject: [PATCH] fixed delayed update viewer fixed `key` not being set to correct value --- app/assets/javascripts/ide/components/repo_editor.vue | 2 +- app/assets/javascripts/ide/stores/modules/commit/getters.js | 6 +++--- app/assets/javascripts/ide/stores/mutations/file.js | 1 + app/assets/javascripts/ide/stores/utils.js | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index c4dd29f5192..b1a16350c19 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -71,7 +71,7 @@ export default { }) .then(() => { const viewerPromise = this.delayViewerUpdated - ? this.updateViewer('editor') + ? this.updateViewer(this.file.pending ? 'diff' : 'editor') : Promise.resolve(); return viewerPromise; diff --git a/app/assets/javascripts/ide/stores/modules/commit/getters.js b/app/assets/javascripts/ide/stores/modules/commit/getters.js index f6d60e1848f..375f9eb2f7c 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/getters.js +++ b/app/assets/javascripts/ide/stores/modules/commit/getters.js @@ -7,9 +7,9 @@ export const commitButtonDisabled = (state, getters, rootState) => getters.discardDraftButtonDisabled || !rootState.stagedFiles.length; export const newBranchName = (state, _, rootState) => - `${gon.current_username}-${ - rootState.currentBranchId - }-patch-${`${new Date().getTime()}`.substr(-5)}`; + `${gon.current_username}-${rootState.currentBranchId}-patch-${`${new Date().getTime()}`.substr( + -5, + )}`; export const branchName = (state, getters, rootState) => { if ( diff --git a/app/assets/javascripts/ide/stores/mutations/file.js b/app/assets/javascripts/ide/stores/mutations/file.js index 5549d601603..7eccc2c82cf 100644 --- a/app/assets/javascripts/ide/stores/mutations/file.js +++ b/app/assets/javascripts/ide/stores/mutations/file.js @@ -131,6 +131,7 @@ export default { if (!changedFile && stagedFile) { Object.assign(state.entries[path], { ...stagedFile, + key: state.entries[path].key, changed: true, }); diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index 597fa3a1c10..00686bdadce 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -88,8 +88,7 @@ export const decorateData = entity => { export const findEntry = (tree, type, name, prop = 'name') => tree.find(f => f.type === type && f[prop] === name); -export const findIndexOfFile = (state, file) => - state.findIndex(f => f.path === file.path); +export const findIndexOfFile = (state, file) => state.findIndex(f => f.path === file.path); export const setPageTitle = title => { document.title = title; -- 2.30.9