Repository navigation
data viewer: redraw column window on pane resize - #18090
Conversation
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.
🍎 macOS Desktop E2E · ARM64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
🐧 Linux Server E2E · Ubuntu 24✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · ubuntu-24.04 · commit |
🐧 Linux Desktop E2E · Ubuntu 24❌ 2 test(s) failed
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · ubuntu-24.04 · commit |
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
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.
…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
Summary
The data viewer grid virtualizes columns: only the columns currently visible in the viewport are rendered, tracked by
colWinStart/colWinEndand recomputed bysyncColumnWindow()(which reads the liveviewport.clientWidth). The scroll handlers (onScroll,onScrollEnd) callsyncColumnWindow()whenever the viewport changes, but theonResizehandler 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 debouncedonResizehandler insrc/cpp/session/resources/grid/DataViewer.js, mirroring the scroll handlers.Notes
NEWS.mdentry is added per the repo convention.DataViewer.jsis a plain-JS iframe resource (not GWT-transpiled); validated withnode --check.Testing
node --checkpasses on the modified file.