Commit 115855e3 authored by Phil Hughes's avatar Phil Hughes

open the last updated file automatically in commit view

parent b2a17468
......@@ -20,7 +20,25 @@ export default {
computed: {
...mapState(['changedFiles', 'stagedFiles']),
},
mounted() {
const lastOpenedFile = [...this.changedFiles, ...this.stagedFiles].sort(
(a, b) => b.lastOpenedAt - a.lastOpenedAt,
)[0];
if (lastOpenedFile) {
this.openPendingTab({
file: lastOpenedFile,
}).then(changeViewer => {
if (changeViewer) {
this.updateViewer('diff');
}
}).catch((e) => {
throw e;
});
}
},
methods: {
...mapActions(['openPendingTab', 'updateViewer']),
...mapActions('commit', ['commitChanges', 'updateCommitAction']),
forceCreateNewBranch() {
return this.updateCommitAction(consts.COMMIT_TO_NEW_BRANCH).then(() => this.commitChanges());
......
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