Skip to content

TT-7579 - #516

Merged
gtryus merged 5 commits into
developfrom
TT-7579Again
Aug 19, 2026
Merged

TT-7579#516
gtryus merged 5 commits into
developfrom
TT-7579Again

Conversation

@sarahentzel

Copy link
Copy Markdown
Collaborator

Why it’s hard to reproduce: the grid virtualizes rows (TT-6986). pageSize was measured once. After paste/save the first paint is a short table (no spacers yet). If that measure sees only a few rows of height, pageSize sticks at ~5 and later sections never mount. On a layout where the inner pane is already the full viewport, the first measure is large enough and everything shows.

A second failure mode: AppLayout is also overflow: auto. If that parent is what actually scrolls, the sheet kept curTop at 1, so scrolling through the blank padding never brought in sections 3–7.

Fix: measure how many rows fit in the visible window, not the short first table; grow the window if unmounted rows are sitting in view as padding; listen to ancestor scroll (capture) so the window moves when AppLayout scrolls.

Why it’s hard to reproduce: the grid virtualizes rows (TT-6986). pageSize was measured once. After paste/save the first paint is a short table (no spacers yet). If that measure sees only a few rows of height, pageSize sticks at ~5 and later sections never mount. On a layout where the inner pane is already the full viewport, the first measure is large enough and everything shows.

A second failure mode: AppLayout is also overflow: auto. If that parent is what actually scrolls, the sheet kept curTop at 1, so scrolling through the blank padding never brought in sections 3–7.

Fix: measure how many rows fit in the visible window, not the short first table; grow the window if unmounted rows are sitting in view as padding; listen to ancestor scroll (capture) so the window moves when AppLayout scrolls.
@sarahentzel
sarahentzel requested review from gtryus and a lite review from Copilot August 19, 2026 17:07

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 addresses hard-to-reproduce PlanSheet virtualization failures caused by early/incorrect viewport measurement and by ancestor scrolling (e.g., AppLayout scrolling instead of the sheet), which could prevent later sections from mounting.

Changes:

  • Extracts and centralizes sheet windowing + viewport math into a reusable sheetWindow module.
  • Computes pageSize based on the visible clip (accounting for clipping/scrolling ancestors) rather than the initial short table paint.
  • Listens to ancestor scroll via capture, adds a ResizeObserver, and adjusts scroll/top padding behavior so the mounted window advances correctly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/renderer/src/components/Sheet/sheetWindow.ts New shared utilities for windowing, clip measurement, and scroll-target detection used by the virtualized sheet.
src/renderer/src/components/Sheet/sheetWindow.test.ts Unit tests covering window sizing, clip calculations, and scroll-target detection.
src/renderer/src/components/Sheet/PlanSheet.tsx Integrates the new window/clip helpers to fix initial measurement and ancestor-scroll virtualization edge cases.
Suppressed comments (1)

src/renderer/src/components/Sheet/PlanSheet.tsx:1351

  • sheetClip() can return null (by type), but this effect uses clip.scrollTop and clip.getBoundingClientRect() without a null check. Since scroller is already validated as non-null, default clip to scroller to satisfy strict null checks and avoid potential runtime issues if sheetClip() ever returns null.
    const clip = sheetClip();
    const pad = topPadElRef.current;
    const floor = scrollTopFloorForPad(
      clip.scrollTop,
      clip.getBoundingClientRect().top,
      pad?.getBoundingClientRect().bottom ?? 0,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/renderer/src/components/Sheet/PlanSheet.tsx
Comment thread src/renderer/src/components/Sheet/sheetWindow.ts Outdated
@sarahentzel
sarahentzel marked this pull request as ready for review August 19, 2026 17:46

@gtryus gtryus 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.

Well, this window logic looks more complicated to me and I can't claim I understood this code like I did the code that used to be there. But hopefully AI got it right.

@gtryus
gtryus merged commit b9d7553 into develop Aug 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants