mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 00:02:56 +00:00
fix: share remote file browser timer cleanup
This commit is contained in:
@@ -61,6 +61,7 @@ export function RemoteFileBrowser({
|
||||
// Why: paste resolution intentionally runs next tick; closing the picker
|
||||
// before then should cancel stale preview work.
|
||||
const pasteResolveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const clickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
// Cache directory listings by absolute resolved path for the lifetime of
|
||||
// the picker so ordinary typing issues at most one remote call per newly
|
||||
// committed segment. targetId does not change within a picker instance.
|
||||
@@ -101,6 +102,10 @@ export function RemoteFileBrowser({
|
||||
clearTimeout(pasteResolveTimerRef.current)
|
||||
pasteResolveTimerRef.current = null
|
||||
}
|
||||
if (clickTimerRef.current) {
|
||||
clearTimeout(clickTimerRef.current)
|
||||
clickTimerRef.current = null
|
||||
}
|
||||
}
|
||||
}, [invalidateBrowseRequests])
|
||||
|
||||
@@ -423,15 +428,6 @@ export function RemoteFileBrowser({
|
||||
}, [resolvedPath, onSelect])
|
||||
|
||||
// Single-click navigates; double-click on a folder selects it.
|
||||
const clickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (clickTimerRef.current) {
|
||||
clearTimeout(clickTimerRef.current)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
// When preview is active, row clicks must be relative to the preview path,
|
||||
// not the committed `resolvedPath`.
|
||||
const listParentPath = preview?.resolvedPath ?? resolvedPath
|
||||
|
||||
Reference in New Issue
Block a user