mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 22:14:08 +00:00
Merge pull request #3551 from overleaf/msm-filetree-increase-scroll-timeout
Increased timeout to perform selected file scroll GitOrigin-RevId: 4bfa8e5a329dded4e7599d3df11625ed19c921e8
This commit is contained in:
parent
9d47b05486
commit
a3176e2b6b
1 changed files with 6 additions and 2 deletions
|
@ -23,14 +23,18 @@ function FileTreeItemInner({ id, name, isSelected, icons }) {
|
|||
useEffect(() => {
|
||||
const item = itemRef.current
|
||||
if (isSelected && item) {
|
||||
// we found scrolling doesn't happen unless a explicit delay is introduced
|
||||
// we're delaying scrolling due to a race condition with other elements,
|
||||
// mainly the Outline, being resized inside the same panel, causing the
|
||||
// FileTree to have its viewport shrinked after the selected item is
|
||||
// scrolled into the view, hiding it again.
|
||||
// See `left-pane-resize-all` in `file-tree-controller` for more information.
|
||||
setTimeout(() => {
|
||||
if (item) {
|
||||
scrollIntoViewIfNeeded(item, {
|
||||
scrollMode: 'if-needed'
|
||||
})
|
||||
}
|
||||
}, 10)
|
||||
}, 100)
|
||||
}
|
||||
}, [isSelected, itemRef])
|
||||
|
||||
|
|
Loading…
Reference in a new issue