Skip to content

Commit

Permalink
Fixes parenting of folder nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Oct 2, 2019
1 parent f66c81c commit 9718c98
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/views/nodes/folderNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ export class FolderNode extends ViewNode<ViewWithFiles> {
this.root.descendants,
this.relativePath === undefined
);
if (nesting !== ViewFilesLayout.List) {
if (nesting === ViewFilesLayout.List) {
this.root.descendants.forEach(n => (n.relativePath = this.root.relativePath));
children = this.root.descendants;
} else {
children = [];
for (const folder of this.root.children.values()) {
if (folder.value === undefined) {
children.push(
new FolderNode(
this.view,
this,
this.folderName ? this : this.parent!,
this.repoPath,
folder.name,
folder,
Expand All @@ -61,12 +64,11 @@ export class FolderNode extends ViewNode<ViewWithFiles> {
continue;
}

// Make sure to set the parent
(folder.value as any).parent = this.folderName ? this : this.parent!;
folder.value.relativePath = this.root.relativePath;
children.push(folder.value);
}
} else {
this.root.descendants.forEach(n => (n.relativePath = this.root.relativePath));
children = this.root.descendants;
}

children.sort((a, b) => {
Expand Down

0 comments on commit 9718c98

Please sign in to comment.