Skip to content

data viewer: redraw column window on pane resize - #18090

Merged
kevinushey merged 1 commit into
mainfrom
bugfix/dataviewer-resize-column-window
Jun 29, 2026
Merged

kevinushey merged 1 commit into
mainfrom
bugfix/dataviewer-resize-column-window

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Summary

The data viewer grid virtualizes columns: only the columns currently visible in the viewport are rendered, tracked by colWinStart/colWinEnd and recomputed by syncColumnWindow() (which reads the live viewport.clientWidth). The scroll handlers (onScroll, onScrollEnd) call syncColumnWindow() whenever the viewport changes, but the onResize handler did not.

As a result, resizing the pane re-applied pinned columns and re-rendered rows against the stale column window. Widening the pane left the table cut off at the old window's right edge instead of filling the newly available space with the now-visible columns.

The fix adds a syncColumnWindow() call at the top of the debounced onResize handler in src/cpp/session/resources/grid/DataViewer.js, mirroring the scroll handlers.

Notes

  • This is a fix to the still-unreleased continuous-column-scrolling work (#17977 / #6147), so no NEWS.md entry is added per the repo convention.
  • DataViewer.js is a plain-JS iframe resource (not GWT-transpiled); validated with node --check.

Testing

  • node --check passes on the modified file.
  • Manual: widen the data viewer pane on a wide data frame and confirm the table now fills the new width instead of staying clipped at the old column window.

The grid virtualizes columns via colWinStart/colWinEnd, recomputed by syncColumnWindow(). The scroll handlers call it, but onResize did not, so resizing the pane redrew rows against the stale column window -- a widened pane left the table cut off at the old window's right edge. Recompute the window in onResize like the scroll handlers do.
@kevinushey kevinushey added this to the 2026.07 (Pacific Dogwood) milestone Jun 29, 2026
@github-actions

Copy link
Copy Markdown

🍎 macOS Desktop E2E · ARM64

✅ All tests passed!

████████████████████ 100% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
404 0 16 0
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · macos-26 ARM64 · commit 26a61001d36c557db42460cc543cd2ab4f811bbb · Run #24

@github-actions

Copy link
Copy Markdown

🐧 Linux Server E2E · Ubuntu 24

✅ All tests passed!

████████████████████ 100% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
393 0 21 1
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · ubuntu-24.04 · commit 26a61001d36c557db42460cc543cd2ab4f811bbb · Run #24

@github-actions

Copy link
Copy Markdown

🐧 Linux Desktop E2E · Ubuntu 24

❌ 2 test(s) failed

███████████████████░ 99% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
409 2 8 1
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · ubuntu-24.04 · commit 26a61001d36c557db42460cc543cd2ab4f811bbb · Run #24

@github-actions

Copy link
Copy Markdown

🪟 Windows Desktop E2E · Server 2025 x64

✅ All tests passed!

████████████████████ 100% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
403 0 19 0
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · Windows Server 2025 x64 · commit 26a61001d36c557db42460cc543cd2ab4f811bbb · Run #24

@kevinushey
kevinushey merged commit b6b46cd into main Jun 29, 2026
21 of 23 checks passed
@kevinushey
kevinushey deleted the bugfix/dataviewer-resize-column-window branch June 29, 2026 23:47
kevinushey added a commit that referenced this pull request Jul 14, 2026
While the data viewer tab is hidden its iframe has no layout: the grid
viewport reads clientWidth/clientHeight/scrollTop/scrollLeft as 0. Grid
code running in that state could corrupt live state in ways the next
tab activation never healed:

- computeColumnWindow collapsed the virtualized column window to a
  single edge column (the zero-width fallback), and window.onActivate
  rebuilt rows against the stale window without recomputing it -- the
  same class of gap #18090 closed for onResize.
- onScroll/onScrollEnd/onDeactivate folded the zeroed scroll reads into
  the lastScrollTop/Left mirrors, discarding the saved position.
- window.onActivate itself can run before the tab widget is shown
  (SourceColumn.onActivate activates the target before selecting its
  tab), with the same effects.

Guard all of these against a collapsed viewport: computeColumnWindow
and the scroll mirrors now ignore zero-geometry reads, and onActivate
defers itself to the next animation frame until layout exists, then
re-derives the column window from live geometry before re-rendering.

The new e2e tests fail without these changes: replaying a scroll tail
or an early onActivate into the hidden iframe loses the scroll position
and leaves the grid rendered at the wrong window on return.

Addresses #18215.
kevinushey added a commit that referenced this pull request Jul 15, 2026
…18233)

* skip empty arguments when scanning for package-library mutations (#18204)

Expressions with empty arguments (e.g. 'View(mtcars[1, ])') caused
.rs.exprMutatesPackageLibrary() to error at the console prompt, since
binding the empty symbol to a variable and evaluating it signals a
missing-argument error. Skip such arguments during recursion.

* opt the data viewer grid out of browser scroll anchoring (#18222)

The grid body and pinned pane are virtualized: scrolling replaces the
rendered row window and resizes the top spacer row. With scroll
anchoring enabled, Chromium adjusts scrollTop to compensate for that
content shift, undoing the user's scroll. Most visible on Windows,
where discrete mouse-wheel ticks are driven through Chromium's
smooth-scroll animation, so wheel scrolling over the table body got
stuck. Same fix the summary sidebar received in #17977.

Addresses #18221

* data viewer: don't corrupt grid state while the tab is hidden (#18223)

While the data viewer tab is hidden its iframe has no layout: the grid
viewport reads clientWidth/clientHeight/scrollTop/scrollLeft as 0. Grid
code running in that state could corrupt live state in ways the next
tab activation never healed:

- computeColumnWindow collapsed the virtualized column window to a
  single edge column (the zero-width fallback), and window.onActivate
  rebuilt rows against the stale window without recomputing it -- the
  same class of gap #18090 closed for onResize.
- onScroll/onScrollEnd/onDeactivate folded the zeroed scroll reads into
  the lastScrollTop/Left mirrors, discarding the saved position.
- window.onActivate itself can run before the tab widget is shown
  (SourceColumn.onActivate activates the target before selecting its
  tab), with the same effects.

Guard all of these against a collapsed viewport: computeColumnWindow
and the scroll mirrors now ignore zero-geometry reads, and onActivate
defers itself to the next animation frame until layout exists, then
re-derives the column window from live geometry before re-rendering.

The new e2e tests fail without these changes: replaying a scroll tail
or an early onActivate into the hidden iframe loses the scroll position
and leaves the grid rendered at the wrong window on return.

Addresses #18215.

* extra defense against failure introspecting expr
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.

1 participant