refactor: remove parent node

This commit is contained in:
EnixCoda 2019-02-22 11:55:46 +08:00
parent 220e6a23f6
commit db5368fef3
No known key found for this signature in database
GPG key ID: 6825847C88AA329A
2 changed files with 0 additions and 11 deletions

View file

@ -145,7 +145,6 @@ const handleKeyDown: MethodCreator<
break
case 'ArrowLeft':
// collapse node or go to parent node
if (expandedNodes.has(focusedNode)) {
dispatch.call(setExpand, focusedNode, false)
} else {

View file

@ -3,7 +3,6 @@ import GitHubHelper, { MetaData, TreeData } from 'utils/GitHubHelper'
interface BasicItem {
name: string | null
path: string | null
parent?: BasicItem | null
mode: null
type: string | null
url: string | null
@ -42,13 +41,6 @@ function sortFoldersToFront(root: Item) {
return depthFirstSearch(root)
}
function setParentNode(root: Item, parent: Item | null = null) {
root.parent = parent
if (root.contents) {
root.contents.forEach(node => setParentNode(node, root))
}
}
function findGitModules(root: Item) {
if (root.contents) {
const modulesFile = root.contents.find(content => content.name === '.gitmodules')
@ -97,8 +89,6 @@ function parse(treeData: TreeData, metaData: MetaData) {
}
})
setParentNode(root)
return {
gitModules: findGitModules(root),
root: sortFoldersToFront(root),