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