Skip to content

fix(app): clamp virtualizer range to scroll bounds#34588

Merged
Hona merged 1 commit into
devfrom
session-virtualizer-repro
Jul 1, 2026
Merged

fix(app): clamp virtualizer range to scroll bounds#34588
Hona merged 1 commit into
devfrom
session-virtualizer-repro

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Move the fix down into our @tanstack/virtual-core patch instead of special-casing the session timeline.
  • Clamp the scroll offset used for range calculation to the real scrollable bounds (0...max(totalSize - viewportSize, 0)).
  • This keeps bottom anchoring / initialOffset: Number.MAX_SAFE_INTEGER from producing an impossible end-of-list range when the browser has clamped a fit-to-viewport list to scrollTop = 0.

Validation

  • bun install --frozen-lockfile
  • bun typecheck from packages/app
  • Local Playwright repro with a 5600px viewport: before the core clamp the session rendered 7 rows starting at index 50; after the clamp it rendered 57 rows from index 0 both initially and after Home → session tab.

Repro evidence

@opencode-agent opencode-agent Bot force-pushed the session-virtualizer-repro branch from 8d08dc1 to 3b57810 Compare June 30, 2026 09:31
@opencode-agent opencode-agent Bot changed the title fix(app): render full session timeline when it fits viewport fix(app): clamp virtualizer range to scroll bounds Jun 30, 2026
@opencode-agent opencode-agent Bot force-pushed the session-virtualizer-repro branch from 3b57810 to af7b6d8 Compare July 1, 2026 01:12
@Hona Hona marked this pull request as ready for review July 1, 2026 01:14
Copilot AI review requested due to automatic review settings July 1, 2026 01:14
@Hona Hona enabled auto-merge (squash) July 1, 2026 01:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s @tanstack/virtual-core patch to clamp the scroll offset used for virtual range calculation to the actual scrollable bounds, preventing invalid “end-of-list” ranges when initialOffset is extremely large but the browser clamps scrollTop to 0.

Changes:

  • Clamp scrollOffset to 0...max(totalSize - viewportSize, 0) before calling calculateRange.
  • Apply the change consistently across the patched package’s src and built dist outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +59 to +60
diff --git a/dist/cjs/index.cjs b/dist/cjs/index.cjs
@@ -716,10 +716,12 @@
Comment on lines +74 to +75
diff --git a/dist/esm/index.js b/dist/esm/index.js
@@ -714,10 +714,12 @@
Comment on lines +89 to +90
diff --git a/src/index.ts b/src/index.ts
@@ -1336,12 +1336,14 @@
@Hona Hona disabled auto-merge July 1, 2026 01:21
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
@opencode-agent opencode-agent Bot force-pushed the session-virtualizer-repro branch from af7b6d8 to 1759967 Compare July 1, 2026 01:25
@Hona Hona merged commit 45a437c into dev Jul 1, 2026
8 checks passed
@Hona Hona deleted the session-virtualizer-repro branch July 1, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants