Commit 31480210 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Fix open and close directory sidebar bug

parent 31eaeb95
...@@ -84,10 +84,11 @@ const RepoHelper = { ...@@ -84,10 +84,11 @@ const RepoHelper = {
mergeNewListToOldList(newList, oldList, inDirectory, indexOfFile) { mergeNewListToOldList(newList, oldList, inDirectory, indexOfFile) {
newList.forEach((newFile) => { newList.forEach((newFile) => {
const fileIndex = indexOfFile + 1;
const file = newFile; const file = newFile;
file.level = inDirectory.level + 1; file.level = inDirectory.level + 1;
oldList.splice(indexOfFile, 0, file); oldList.splice(fileIndex, 0, file);
}); });
return oldList; return oldList;
......
...@@ -44,10 +44,13 @@ export default class RepoSidebar { ...@@ -44,10 +44,13 @@ export default class RepoSidebar {
let url = ''; let url = '';
let file = clickedFile; let file = clickedFile;
if (typeof file === 'object') { if (typeof file === 'object') {
if (file.type === 'tree' && file.opened) file = Store.removeChildFilesOfTree(file); if (file.type === 'tree' && file.opened) {
url = file.url; file = Store.removeChildFilesOfTree(file);
Service.url = url; } else {
Helper.getContent(file); url = file.url;
Service.url = url;
Helper.getContent(file);
}
} else if (typeof file === 'string') { } else if (typeof file === 'string') {
// go back // go back
url = file; url = file;
......
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