mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 16:02:49 +00:00
fix(sidebar): avoid re-centering on worktree selection unless out of view
Switch the reveal scroll from align:'center' to align:'auto' so clicking a worktree only scrolls the sidebar when its card is not already visible. Centering on every click made the list feel jumpy during normal navigation. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -150,7 +150,11 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp
|
||||
(row) => row.type === 'item' && row.worktree.id === pendingRevealWorktreeId
|
||||
)
|
||||
if (targetIndex !== -1) {
|
||||
virtualizer.scrollToIndex(targetIndex, { align: 'center' })
|
||||
// Why: `align: 'auto'` is a no-op when the card is already visible and
|
||||
// otherwise scrolls the minimum amount to bring it into view. Using
|
||||
// 'center' here made every worktree click re-center the sidebar, which
|
||||
// is visually jumpy even when nothing needed to move.
|
||||
virtualizer.scrollToIndex(targetIndex, { align: 'auto' })
|
||||
}
|
||||
clearPendingRevealWorktreeId()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user