Repository navigation
fix(sidebar): do not sticky-pin Project header without mounted geometry - #10090
Conversation
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 5b7f6499bb2c07077c48428bfeda7bcf823bc494 and 7dfdab9. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated sticky-header resolution to prefer a previously mounted header when the computed candidate is not present in the virtual items. Added tests covering unmounted group headers and partially mounted multi-group scenarios, including expected host and group sticky indexes. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4b105c72-46da-43df-9d85-c389e6979da6
📥 Commits
Reviewing files that changed from the base of the PR and between 1d8ce38 and 5b7f6499bb2c07077c48428bfeda7bcf823bc494.
📒 Files selected for processing (2)
src/renderer/src/components/sidebar/worktree-list-virtual-rows.test.tssrc/renderer/src/components/sidebar/worktree-list-virtual-rows.ts
| const previous = getPreviousStickyHeaderIndex(candidates, candidateIndex) | ||
| if (previous !== null) { | ||
| const previousItem = args.virtualItems.find((item) => item.index === previous) | ||
| if (previousItem) { | ||
| return previous | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep mounted-previous fallback scoped to Project groups.
Because host resolution passes fallbackToCandidate: true, this new branch can retain Host A when rangeStartIndex has already advanced to an unmounted Host B. Previously it returned Host B’s candidate ID; this changes the host-tier behavior the PR explicitly intends to preserve.
Proposed fix
const resolveWithHandoff = (
candidates: readonly number[],
pinnedOffset: number,
- fallbackToCandidate: boolean
+ fallbackToCandidate: boolean,
+ preferMountedPrevious: boolean
): number | null => {
...
- if (!candidate) {
+ if (!candidate && preferMountedPrevious) {
const previous = getPreviousStickyHeaderIndex(candidates, candidateIndex)
if (previous !== null) {
const previousItem = args.virtualItems.find((item) => item.index === previous)
if (previousItem) {
return previous
}
}
- return fallbackToCandidate ? candidateIndex : null
}
+ if (!candidate) return fallbackToCandidate ? candidateIndex : null
...
- const hostIndex = resolveWithHandoff(hostIndexes, 0, true)
+ const hostIndex = resolveWithHandoff(hostIndexes, 0, true, false)
...
const groupIndex = resolveWithHandoff(
groupIndexes,
hostIndex !== null ? HOST_STICKY_PINNED_HEIGHT : 0,
- hostIndex === null
+ hostIndex === null,
+ true
)Based on PR objectives, “Host-tier fallback behavior remains unchanged.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const previous = getPreviousStickyHeaderIndex(candidates, candidateIndex) | |
| if (previous !== null) { | |
| const previousItem = args.virtualItems.find((item) => item.index === previous) | |
| if (previousItem) { | |
| return previous | |
| } | |
| } | |
| const resolveWithHandoff = ( | |
| candidates: readonly number[], | |
| pinnedOffset: number, | |
| fallbackToCandidate: boolean, | |
| preferMountedPrevious: boolean | |
| ): number | null => { | |
| if (!candidate && preferMountedPrevious) { | |
| const previous = getPreviousStickyHeaderIndex(candidates, candidateIndex) | |
| if (previous !== null) { | |
| const previousItem = args.virtualItems.find((item) => item.index === previous) | |
| if (previousItem) { | |
| return previous | |
| } | |
| } | |
| } | |
| if (!candidate) return fallbackToCandidate ? candidateIndex : null | |
| } | |
| const hostIndex = resolveWithHandoff(hostIndexes, 0, true, false) | |
| const groupIndex = resolveWithHandoff( | |
| groupIndexes, | |
| hostIndex !== null ? HOST_STICKY_PINNED_HEIGHT : 0, | |
| hostIndex === null, | |
| true | |
| ) |
During scrollToIndex/reveal, rangeStartIndex can advance before TanStack mounts the candidate Project row. Returning that unmounted index made a Project sticky paint over the Host card in multi-host views. Prefer a previous mounted sticky (or none for the group tier) until geometry exists. Closes stablyai#10088
5b7f649 to
7dfdab9
Compare
|
Thanks so much for this, @innocarpe — do not sticky-pin Project header without mounted geometry. Verified (fail-on-main/pass-on-branch), reviewed, and merged. Really appreciate it! 🙏 |
|
thanks for reporting. looking into it |
…ry (stablyai#10090) During scrollToIndex/reveal, rangeStartIndex can advance before TanStack mounts the candidate Project row. Returning that unmounted index made a Project sticky paint over the Host card in multi-host views. Prefer a previous mounted sticky (or none for the group tier) until geometry exists. Closes stablyai#10088
fix(sidebar): do not sticky-pin Project header without mounted geometry
Summary
Fixes the multi-host Projects sidebar painting a project-group sticky header over the host card when revealing or scrolling to a workspace (#10088).
ELI5
In the sidebar, jumping to a project under a host could make the project's name label overlap and cover the host's card. This makes the sticky labels stay in the right place while you scroll.
Root cause & fix
getActiveStickyIndexesForScroll→resolveWithHandoffreturned the candidate sticky header index even when that virtual row wasn't mounted yet — which happens whenscrollToIndex/reveal advancesrangeStartIndexbefore TanStack mounts the row. A Project sticky then activated without any geometry while the Host sticky was still active. The fix now prefers a previously-mounted sticky header when the candidate is unmounted, and only falls back to the raw candidate whenfallbackToCandidateis true (host tier). The group tier (fallbackToCandidate=false) returnsnullinstead of pinning without geometry.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
src/renderer/src/components/sidebar/worktree-list-virtual-rows.test.tsoxlintclean (no warnings/errors) on the fix file.origin/main.Trade-offs
None — pure fix. Host tier retains its legacy fallback so a re-mounting host section keeps sticky identity.
Regression risk
Effectively zero. Only the branch that handled an unmounted candidate changes; every path with a mounted candidate or a truthy
fallbackToCandidatebehaves identically. The host tier is byte-for-byte preserved, and the passing test proves both the new group-tier and previous-sticky-hold behaviors.Original fix by @innocarpe. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.