Repository navigation
fix(sidebar): keep project headers from overlapping the pinned host - #26775
Conversation
The host header lays out as a 32px card in 4px top padding (36px), but estimateRenderRowSize sized the row at 32px. The group tier's 36px pin offset then fired 4px early, so a project header could pin while its in-flow copy was still on screen — two headers at one coordinate. Size the host row 36px so it matches the pinned slot, and resolve each sticky handoff from the row's real start offset instead of only the lagging range start, so a header pins exactly when it reaches the slot.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe host header row height changes from 32 to 36 pixels, and the pinned host height uses that constant. Sticky-header selection now considers both the virtual range start and mounted row positions relative to the scroll offset and pinned slot. Tests cover group-header transitions, delayed virtual ranges, and host-row height estimates. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to This fixes sidebar project headers overlapping the pinned host by matching the host row height to the pinned slot and improving sticky-header selection. No merge-blocking risk was found; manual multi-host visual checks are still worth doing. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches📝 Generate docstrings
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 |
ELI5
In the Projects sidebar with more than one host, the host card and the project headers below it stay pinned to the top while you scroll. The code that decides when the next project header takes over made two mistakes: it treated the host card as 32px tall when it really occupies 36px, and it chose which header to pin from a scroll position that trails the real one by a frame. Either mistake can pin a project header at the same moment its normal in-flow copy is still on screen, so two headers sit on top of each other. This makes the host row count as its true 36px and decides the handoff from where each row actually sits.
What Changed
Before:
estimateRenderRowSizesized a host row at 32px, while the pinned host slot is 36px (the card ish-8insidept-1). The group tier's handoff test (scrollOffset + 36 >= candidate.start) therefore fired 4px early, and the pinned candidate was picked only from the virtualizer'srangeStartIndex, which lags the real scroll position. A project header could be pinned while its in-flow row was still laid out below.After: the host row is measured at 36px, matching the pinned slot, and
getActiveStickyIndexesForScrollpicks the candidate whose row has actually reached the slot (virtualItems.get(index).start <= scrollOffset + pinnedOffset) in addition to the one the range start points at. A header is pinned exactly when it reaches the slot.Why
The mismatch between the measured host row (32px) and the pinned slot (36px) is the direct cause of the overlap: the handoff math runs 4px ahead of the painted layout. Reading each candidate's real
startfrom the mounted virtual items also removes the one-frame lag betweenrangeStartIndexand the scroll position, so the correct header is selected without waiting for the range extractor to catch up. The alternative — resyncing only on scroll events — misses the reported case, because the overlap appears without a scroll (e.g. expanding/collapsing a group) and a list too short to scroll may never emit one.Linked Issue
Fixes #12532
Fixes #18820
#12532's report derives this exact fix from the shipped bundle: the group tier's
pinnedOffsetis a constant 36 while the host header it offsets past is estimated at 32px, so the group activates 4px early and two headers land on one coordinate. #18820 is the same double-render symptom (a header painted once pinned and once in flow).Same defect family / related (not closed by this PR):
Visual Proof
Pending — this is a virtualizer layout change visible only with a multi-host sidebar and project groups collapsing/expanding. Before/after screenshots or a short video still need to be captured in a multi-host session.
Testing
virtual-rows.test.tscovers the handoff at the host slot, the first project pinning while the range still starts at the host, selection across several collapsed groups, lagging-range host transitions, and the host row height. Ran: focused Vitest (24 pass),pnpm tc:web, andpnpm run check:code-quality:changed.Platforms: unit tests only so far. No app run; multi-host visual QA is outstanding.
Notes
Mapbuild per sticky resolution over the already-iterated mounted virtual items; negligible.Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)