mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: better experience with correct focus
This commit is contained in:
parent
2227039bbf
commit
3203f9426e
1 changed files with 2 additions and 2 deletions
|
|
@ -175,13 +175,13 @@ function ListView({
|
|||
const listRef = React.useRef<FixedSizeList>(null)
|
||||
const { focusedNode, nodes } = visibleNodes
|
||||
React.useEffect(() => {
|
||||
if (listRef.current && focusedNode?.path) {
|
||||
if (listRef.current && focusedNode) {
|
||||
const index = nodes.findIndex(node => node.path === focusedNode.path)
|
||||
if (index !== -1) {
|
||||
listRef.current.scrollToItem(index, 'smart')
|
||||
}
|
||||
}
|
||||
}, [focusedNode?.path])
|
||||
})
|
||||
|
||||
const goToCurrentItem = React.useCallback(() => {
|
||||
const targetPath = platform.getCurrentPath(metaData.branchName)
|
||||
|
|
|
|||
Loading…
Reference in a new issue