Commit b61aa6f8 authored by Phil Hughes's avatar Phil Hughes

fixed staged/unstaged files not opening when another 1 is open

fixes eslint
parent 748cd767
...@@ -50,11 +50,7 @@ export default { ...@@ -50,11 +50,7 @@ export default {
...mapGetters(['collapseButtonIcon', 'collapseButtonTooltip']), ...mapGetters(['collapseButtonIcon', 'collapseButtonTooltip']),
}, },
methods: { methods: {
...mapActions([ ...mapActions(['toggleRightPanelCollapsed', 'stageAllChanges', 'unstageAllChanges']),
'toggleRightPanelCollapsed',
'stageAllChanges',
'unstageAllChanges',
]),
actionBtnClicked() { actionBtnClicked() {
this[this.action](); this[this.action]();
}, },
...@@ -131,6 +127,7 @@ export default { ...@@ -131,6 +127,7 @@ export default {
<list-item <list-item
:file="file" :file="file"
:action-component="itemActionComponent" :action-component="itemActionComponent"
:key-prefix="title"
/> />
</li> </li>
</ul> </ul>
......
...@@ -19,6 +19,11 @@ export default { ...@@ -19,6 +19,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
keyPrefix: {
type: String,
required: false,
default: '',
},
}, },
computed: { computed: {
iconName() { iconName() {
...@@ -39,7 +44,7 @@ export default { ...@@ -39,7 +44,7 @@ export default {
openFileInEditor() { openFileInEditor() {
return this.openPendingTab({ return this.openPendingTab({
file: this.file, file: this.file,
keyPrefix: this.file.staged ? 'staged' : 'unstaged', keyPrefix: this.keyPrefix.toLowerCase(),
}).then(changeViewer => { }).then(changeViewer => {
if (changeViewer) { if (changeViewer) {
this.updateViewer('diff'); this.updateViewer('diff');
......
...@@ -154,9 +154,10 @@ export default { ...@@ -154,9 +154,10 @@ export default {
}); });
}, },
[types.ADD_PENDING_TAB](state, { file, keyPrefix = 'pending' }) { [types.ADD_PENDING_TAB](state, { file, keyPrefix = 'pending' }) {
const pendingTab = state.openFiles.find(f => f.path === file.path && f.pending); const key = `${keyPrefix}-${file.key}`;
const pendingTab = state.openFiles.find(f => f.key === key && f.pending);
let openFiles = state.openFiles.map(f => let openFiles = state.openFiles.map(f =>
Object.assign(f, { active: f.path === file.path, opened: false, active: false }), Object.assign(f, { active: f.key === key, opened: false }),
); );
if (!pendingTab) { if (!pendingTab) {
...@@ -172,7 +173,7 @@ export default { ...@@ -172,7 +173,7 @@ export default {
active: true, active: true,
pending: true, pending: true,
opened: true, opened: true,
key: `${keyPrefix}-${f.key}`, key,
}); });
} }
......
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