mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: update visible nodes when at root path
This commit is contained in:
parent
874894261b
commit
1f3378beed
1 changed files with 8 additions and 10 deletions
|
|
@ -248,17 +248,15 @@ const search: MethodCreator<Props, ConnectorState, [string]> = dispatch => {
|
|||
const delayExpandThreshold = 400
|
||||
|
||||
const goTo: MethodCreator<Props, ConnectorState, [string[]]> = dispatch => async currentPath => {
|
||||
if (currentPath.length) {
|
||||
await visibleNodesGenerator.search('')
|
||||
dispatch.set({ searchKey: '', searched: false })
|
||||
const nodeExpandedTo = visibleNodesGenerator.expandTo(currentPath.join('/'))
|
||||
if (nodeExpandedTo) {
|
||||
visibleNodesGenerator.focusNode(nodeExpandedTo)
|
||||
const { nodes } = visibleNodesGenerator.visibleNodes
|
||||
tasksAfterRender.push(() => DOMHelper.scrollToNodeElement(nodes.indexOf(nodeExpandedTo)))
|
||||
dispatch.call(updateVisibleNodes)
|
||||
}
|
||||
await visibleNodesGenerator.search('')
|
||||
dispatch.set({ searchKey: '', searched: false })
|
||||
const nodeExpandedTo = visibleNodesGenerator.expandTo(currentPath.join('/'))
|
||||
if (nodeExpandedTo) {
|
||||
visibleNodesGenerator.focusNode(nodeExpandedTo)
|
||||
const { nodes } = visibleNodesGenerator.visibleNodes
|
||||
tasksAfterRender.push(() => DOMHelper.scrollToNodeElement(nodes.indexOf(nodeExpandedTo)))
|
||||
}
|
||||
dispatch.call(updateVisibleNodes)
|
||||
}
|
||||
|
||||
function shouldDelayExpand(node: TreeNode) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue