mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
Revert "feat: better experience with correct focus"
This reverts commit 3203f9426e.
This commit is contained in:
parent
8c970d7fb4
commit
396af20fa4
1 changed files with 5 additions and 2 deletions
|
|
@ -182,13 +182,16 @@ function ListView({
|
|||
const listRef = React.useRef<FixedSizeList>(null)
|
||||
const { focusedNode, nodes } = visibleNodes
|
||||
React.useEffect(() => {
|
||||
if (listRef.current && focusedNode) {
|
||||
if (listRef.current && focusedNode?.path) {
|
||||
const index = nodes.findIndex(node => node.path === focusedNode.path)
|
||||
if (index !== -1) {
|
||||
listRef.current.scrollToItem(index, 'smart')
|
||||
}
|
||||
}
|
||||
})
|
||||
}, [focusedNode?.path])
|
||||
// For some reason, removing the deps array above results in bug:
|
||||
// If scroll fast and far, then clicking on items would result in redirect
|
||||
// Not know the reason :(
|
||||
|
||||
const goToCurrentItem = React.useCallback(() => {
|
||||
const targetPath = platform.getCurrentPath(metaData.branchName)
|
||||
|
|
|
|||
Loading…
Reference in a new issue