mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: simplify logic
This commit is contained in:
parent
eeb2aeee00
commit
1d73b52d31
1 changed files with 8 additions and 15 deletions
|
|
@ -287,22 +287,15 @@ class FlattenLayer extends CompressLayer {
|
|||
const rootNode = this.compressedRoot
|
||||
if (rootNode) {
|
||||
await traverse(
|
||||
[rootNode],
|
||||
rootNode.contents,
|
||||
async node => {
|
||||
const overflowChar = node.path[path.length + 1]
|
||||
const nextChar = path.slice(node.path.length, node.path.length + 1)
|
||||
const match =
|
||||
path.startsWith(node.path) &&
|
||||
(overflowChar === '/' || !overflowChar) &&
|
||||
(!node.path || nextChar === '/' || !nextChar)
|
||||
if (node.path) {
|
||||
// rootNode.path === ''
|
||||
if (match) {
|
||||
if (node.path === path) {
|
||||
// do not wait for expansion for the exact node as that will block "jumping from search"
|
||||
this.$setExpand(node, true)
|
||||
} else await this.$setExpand(node, true)
|
||||
}
|
||||
const overflowChar = path[node.path.length]
|
||||
const match = path.startsWith(node.path) && (overflowChar === '/' || !overflowChar)
|
||||
if (match) {
|
||||
if (node.path === path) {
|
||||
// do not wait for expansion for the exact node as that will block "jumping from search"
|
||||
this.$setExpand(node, true)
|
||||
} else await this.$setExpand(node, true)
|
||||
}
|
||||
return match
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue