mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
perf(FileExplorer): skip scrollIntoView when click on tree Node
This commit is contained in:
parent
46436b0575
commit
603564456f
2 changed files with 6 additions and 6 deletions
|
|
@ -157,15 +157,15 @@ export default class List extends React.Component {
|
|||
this.tasksAfterRender.push(DOMHelper.focusSearchInput)
|
||||
}
|
||||
|
||||
toggleNodeExpand = node => {
|
||||
toggleNodeExpand = (node, skipScrollToNode) => {
|
||||
this.visibleNodesGenerator.toggleExpand(node)
|
||||
this.focusNode(node)
|
||||
this.focusNode(node, skipScrollToNode)
|
||||
this.tasksAfterRender.push(DOMHelper.focusFileExplorer)
|
||||
}
|
||||
|
||||
focusNode = node => {
|
||||
focusNode = (node, skipScroll) => {
|
||||
this.visibleNodesGenerator.focusNode(node)
|
||||
if (node) {
|
||||
if (node && !skipScroll) {
|
||||
// when focus a node not in viewport(by keyboard), scroll to it
|
||||
const { visibleNodes: { nodes } } = this.state
|
||||
const indexOfToBeFocusedNode = nodes.indexOf(node)
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ function getIconType(node) {
|
|||
}
|
||||
|
||||
export default class Node extends React.PureComponent {
|
||||
onNodeClick = (...args) => {
|
||||
onNodeClick = () => {
|
||||
const { node, toggleExpand } = this.props
|
||||
if (node.type === 'tree') {
|
||||
toggleExpand(node, ...args)
|
||||
toggleExpand(node, true)
|
||||
} else {
|
||||
DOMHelper.loadWithPJAX(node.url)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue