mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: blank file explorer when accessing non-exist file
This commit is contained in:
parent
b003f3acc3
commit
39c1653d90
2 changed files with 6 additions and 3 deletions
|
|
@ -32,9 +32,11 @@ export default class List extends preact.Component {
|
|||
this.tasksAfterRender.push(DOMHelper.focusSearchInput)
|
||||
if (currentPath.length) {
|
||||
const nodeExpandedTo = this.visibleNodesGenerator.expandTo(currentPath)
|
||||
this.visibleNodesGenerator.focusNode(nodeExpandedTo)
|
||||
const { nodes } = this.visibleNodesGenerator.visibleNodes
|
||||
this.tasksAfterRender.push(() => DOMHelper.scrollToNodeElement(nodes.indexOf(nodeExpandedTo)))
|
||||
if (nodeExpandedTo) {
|
||||
this.visibleNodesGenerator.focusNode(nodeExpandedTo)
|
||||
const { nodes } = this.visibleNodesGenerator.visibleNodes
|
||||
this.tasksAfterRender.push(() => DOMHelper.scrollToNodeElement(nodes.indexOf(nodeExpandedTo)))
|
||||
}
|
||||
}
|
||||
this.updateVisibleNodes()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ export default class VisibleNodesGenerator {
|
|||
for (const step of path) {
|
||||
targetPath = rootNode.path ? `${rootNode.path}/${step}` : step
|
||||
rootNode = rootNode.contents.find(node => node.path === targetPath)
|
||||
if (!rootNode) return
|
||||
this.setExpand(rootNode, true)
|
||||
}
|
||||
return rootNode
|
||||
|
|
|
|||
Loading…
Reference in a new issue