Repository navigation
fix(sidebar): keep group headers visible when measured rows grow - #20883
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe scroll-adjustment predicate now considers item bounds, scroll offset, first-measurement state, and scroll direction. The virtualizer passes these values for resized items. Unit tests cover anchor and scrolling cases. A new end-to-end test grows an idle worktree card and verifies that collapsed project-group geometry and scroll position remain unchanged. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The sidebar measurement change includes coverage for the reported non-scrollable layout regression and its geometry remains stable after card growth. No current merge-blocking risk was identified. 🚥 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.
✅ No new issues found.
Reviewed changes
- Restored TanStack's fold rule in the measurement predicate —
shouldAdjustWorktreeSidebarMeasuredRowScrollnow adjusts a first measurement only when its start is above the anchor, and a remeasurement only when its end is at or above the anchor and the direction is not backward. This matches@tanstack/[email protected]'sresizeItemdefault, verified against the installed package source; the wall-clock/is-scrolling suppression gate is preserved in front of it. - Passed geometry into the predicate from the virtualizer —
use-virtualizer.tssuppliesitem.start/item.end,scrollOffset(instance.scrollOffset ?? scrollOffsetRef.currentplusscrollAdjustments),isFirstMeasurementfromitemSizeCache, andscrollDirection. All of these are public on theVirtualizertype and align with the library's internalscrollOffsetWithAdj/isFirstMeasurecomputation. - Added pure policy tests —
scroll-adjustment.test.tspins the below-anchor, spanning, boundary, first-measurement, and backward-direction branches beside the existing suppression cases. - Added a rendered Electron regression —
sidebar-measured-row-scroll.spec.tsgrows a lower card through the DOM in an unscrollable three-repo sidebar and asserts the collapsed group stays hit-testable with unchanged header gaps, so it fails on the obscured-group assertion rather than merely checking DOM presence.
I traced the changed predicate against the TanStack default and confirmed the new logic is a strict narrowing of the previous behavior — below-anchor growth is now rejected while suppression, anchor/reveal, and expanding-card paths are unchanged. The new signature has only one production caller (updated) and one test caller (updated), so no stale call sites remain.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
A card growing lower in the sidebar could make the sidebar act as though it had scrolled, even when the whole list still fit on screen. That could pin LaunchStack over the collapsed Research gang header and leave an empty slot underneath. This change keeps the existing scroll protections while preventing that incorrect movement.
What Changed
Why
The custom
shouldAdjustScrollPositionOnItemSizeChangecallback replaced TanStack's spatial rule with only a time/scrolling gate. A +50px measurement below the anchor could therefore request scroll offset 50 while the non-scrollable DOM remained at 0. Sticky-header selection then trusted the virtualizer's optimistic offset and covered the group with the next project header.This fixes that producer rather than hiding the sticky header or changing catalog data. The existing 500ms user-scroll grace, 300ms agent-expansion suppression, asynchronous virtualizer updates, anchor/reveal behavior, and overscan remain unchanged. It does not add a generic repair for every possible offset mismatch.
Linked Issue
Fixes #18667.
Related: #18662 independently proposed the same position guard together with a broader offset-reconciliation layer. This PR keeps the primary guard narrow and supplies an actual rendered red/green reproduction. This is a different mechanism from the duplicate-group insertion race fixed in #19170; it does not claim to solve every disappearing-sidebar report.
Visual Proof
Same hidden Electron scenario, viewport, repositories, and +50px lower-card growth. Both images are captured after the growth: the left uses the original callback, the right uses the fixed callback. The diagnostic DOM growth exercises the real ResizeObserver/virtualizer path; it does not measure how frequently production content triggers the bug.
Images uploaded with
gh image; no screenshot binaries are committed.Testing
Observed on macOS arm64. All app/test launches used
ORCA_BACKGROUND_LAUNCH=1; no test window was revealed or focused.Passing
scroll-adjustment.test.tspasses all 23 tests.pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar src/renderer/src/hooks/useVirtualizedScrollAnchor src/renderer/src/store/slices/repos-project-group-create-race.test.ts— 307 files / 2,608 tests passed.project-group-creation-visibility.spec.tsscenarios gives 3 passed.pnpm lint,pnpm typecheck, and fullpnpm buildpassed. E2E builds passed for both original and fixed implementations.v1.4.190baseline tag, both previously blocked cross-version unit files passed: 20 tests.Full-suite results and limitations — not an all-green claim
pnpm test --maxWorkers=4completed: 8,748 files passed, 5 failed, 63 skipped. Two failed files were the missing-tag cross-version prerequisite and passed on the rerun above.set -u. These tests were not weakened or excluded to manufacture a green result.pnpm typecheck:e2ereports diagnostics in untouched E2E specs; it reports none in the changed files.CI status for
102df83e688b489195cc38875ce258e2f4b604af: PR Checks and PR test LoC require maintainer approval (action_required; no jobs ran). This contributor has read-only upstream access and cannot approve those runs. The separate Pullfrog review is in progress. An explicit fork E2E dispatch was also unavailable (workflow API returned 404), so no full E2E result is claimed.Reproduce the rendered check with:
AI Disclosure
AI-assisted investigation, implementation, tests, and review with OpenAI Codex (GPT-6 Astra).
Review
Agent skill upstream boundary
Notes
No version bump, release changes, screenshot files, or diagnostic production hooks. No documentation/configuration migration is needed for this restored behavior.
Author
GitHub: @kiendle. X/Twitter handle: not provided; none listed on the GitHub profile.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (full-suite exceptions disclosed above; upstream CI awaits maintainer approval)