diff options
author | Phil Hughes <me@iamphill.com> | 2018-04-11 09:30:08 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-04-11 09:30:08 +0100 |
commit | cb197ceb8031acb324510ce124a280caf2649442 (patch) | |
tree | 0f24a83297be99e60aaeffae03d748064431b5a5 /app | |
parent | 49d8a62eff6517084d3571995ca698d0f945ee98 (diff) | |
download | gitlab-ce-cb197ceb8031acb324510ce124a280caf2649442.tar.gz |
correctly dispose cached models
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 87016ff5e01..d782e0a84d2 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -156,7 +156,7 @@ export const setFileViewMode = ({ state, commit }, { file, viewMode }) => { commit(types.SET_FILE_VIEWMODE, { file, viewMode }); }; -export const discardFileChanges = ({ state, commit }, path) => { +export const discardFileChanges = ({ dispatch, state, commit, getters }, path) => { const file = state.entries[path]; commit(types.DISCARD_FILE_CHANGES, path); @@ -164,9 +164,18 @@ export const discardFileChanges = ({ state, commit }, path) => { if (file.tempFile && file.opened) { commit(types.TOGGLE_FILE_OPEN, path); + } else if (getters.activeFile && file.path === getters.activeFile.path) { + dispatch('updateDelayViewerUpdated', true) + .then(() => { + router.push(`/project${file.url}`); + }) + .catch(e => { + throw e; + }); } eventHub.$emit(`editor.update.model.new.content.${file.key}`, file.content); + eventHub.$emit(`editor.update.model.dispose.unstaged-${file.key}`, file.content); }; export const stageChange = ({ commit, state }, path) => { |