mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
chore: debug current path
This commit is contained in:
parent
13a118f839
commit
b8abf40b31
1 changed files with 11 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import { SearchBar } from 'components/SearchBar'
|
|||
import { useConfigs } from 'containers/ConfigsContext'
|
||||
import { PortalContext } from 'containers/PortalContext'
|
||||
import { RepoContext } from 'containers/RepoContext'
|
||||
import { platform } from 'platforms'
|
||||
import { useInspector } from 'containers/StateInspector'
|
||||
import * as React from 'react'
|
||||
import { usePrevious, useUpdateEffect } from 'react-use'
|
||||
import { cx } from 'utils/cx'
|
||||
|
|
@ -171,13 +171,21 @@ function LoadedFileExplorer({
|
|||
const renderLabelText = useRenderLabelText(searchKey)
|
||||
|
||||
const goToCurrentItem = React.useCallback(() => {
|
||||
const targetPath = platform.getCurrentPath(metaData.branchName)
|
||||
const targetPath = getCurrentPath()
|
||||
if (targetPath) expandTo(targetPath)
|
||||
}, [metaData.branchName, expandTo])
|
||||
}, [getCurrentPath, expandTo])
|
||||
|
||||
useOnLocationChange(goToCurrentItem)
|
||||
useAfterRedirect(goToCurrentItem)
|
||||
|
||||
const [currentPath, setCurrentPath] = React.useState(() => getCurrentPath())
|
||||
useAfterRedirect(
|
||||
React.useCallback(() => {
|
||||
setCurrentPath(getCurrentPath())
|
||||
}, [getCurrentPath]),
|
||||
)
|
||||
useInspector('CurrentPath', currentPath)
|
||||
|
||||
const ref = React.useRef<HTMLDivElement | null>(null)
|
||||
useFocusOnPendingTarget(
|
||||
'files',
|
||||
|
|
|
|||
Loading…
Reference in a new issue