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-agentopencode-agentBot 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-agentBotforce-pushed the session-virtualizer-repro branch from 8d08dc1 to 3b57810CompareJune 30, 2026 09:31
@opencode-agentopencode-agentBot changed the title fix(app): render full session timeline when it fits viewportfix(app): clamp virtualizer range to scroll boundsJun 30, 2026
@opencode-agent
opencode-agentBotforce-pushed the session-virtualizer-repro branch from 3b57810 to af7b6d8CompareJuly 1, 2026 01:12
@Hona
Hona marked this pull request as ready for review July 1, 2026 01:14
CopilotAI review requested due to automatic review settings July 1, 2026 01:14
@Hona
Hona enabled auto-merge (squash) July 1, 2026 01:14

CopilotAI 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-agentBotforce-pushed the session-virtualizer-repro branch from af7b6d8 to 1759967CompareJuly 1, 2026 01:25
@Hona
Hona merged commit 45a437c into devJul 1, 2026
8 checks passed
@Hona
Hona deleted the session-virtualizer-repro branch July 1, 2026 01:28
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 20, 2026
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
3kaiu pushed a commit to 3kaiu/opencode-x that referenced this pull request Jul 31, 2026
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
banlanzs pushed a commit to banlanzs/opencode that referenced this pull request Aug 6, 2026
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
charlesverge pushed a commit to charlesverge/opencode that referenced this pull request Aug 11, 2026
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Hona