Skip to content

keep data viewer pinned columns pinned across column pagination - #17838

Merged
kevinushey merged 7 commits into
mainfrom
bugfix/17835-pinned-columns-pagination
Jun 4, 2026
Merged

kevinushey merged 7 commits into
mainfrom
bugfix/17835-pinned-columns-pagination

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Intent

Addresses #17835.

A column pinned in the data viewer stopped tracking its original column once you
paged to a different set of columns in a very wide data frame (ncol > the
200-column page size). The pin stayed on whatever column now occupied that slot
instead of the column the user pinned.

Cause

Pinned columns -- and, as it turns out, the sort column and per-column filters --
were tracked by their position within the currently fetched column window,
not by a stable column identity. The backend also only sent the contiguous
window of columns, so once a pinned column scrolled out of the window its data
wasn't even on the client anymore.

Change

Track pinned columns, the sort column, and per-column filters by absolute
column index
in the full frame. The column request is now an explicit ordered
list of absolute indices (pinned columns first, then the visible window), so a
pinned column outside the window is fetched alongside it and keeps both its
identity and its data across pagination. Each column the server returns carries
its absolute col_index. This also lets the backend drop the column-offset
realignment it used to apply to sort/filter indices.

Saved per-object UI state now persists these as absolute identities (state
version bumped so stale positional payloads are dropped).

Also included

  • Filter editor preserved across header rebuilds. The post-load column
    auto-size rebuilds the header row, which previously tore down an open
    per-column filter editor mid-type. It's now deferred while an editor is open
    and flushed when it closes -- so keystrokes typed into a filter immediately
    after opening a wide frame aren't lost.
  • e2e test speedup + profiling docs. The per-column filter test opened its
    retry loop with inputValue() on an input that didn't exist yet, blocking
    ~10s per load; it now probes with count() and waits for the initial row
    batch first (test body ~12s -> ~2s). Added a "Profiling a slow test" recipe
    (force a trace, pair before/after events in test.trace) to the e2e
    README and the run-playwright-tests skill.

Testing

  • ./rstudio-tests --scope r --filter dataviewer -- 91 pass (rewrote the
    describeColSlice tests for the new describeColsByIndex; added col_index
    and column-ordering coverage).
  • Playwright tests/panes/data-viewer/ -- 16 pass, including a new regression
    test that pins column 1 in a 300-column frame, pages to columns 101-300, and
    asserts the pinned slot still reports absolute column 1 and that its data
    followed the pin.

Pinned columns, the sort column, and per-column filters are now tracked by
absolute column index in the full frame rather than by their position within
the currently fetched window, and the column request asks for any pinned
columns alongside the visible window so an off-window pinned column keeps its
data. Previously a pinned column was tracked by window position, so paging to
a different set of columns left the pin on whatever column now occupied that
slot.

The server-side column request is now an explicit ordered list of absolute
column indices (pinned first, then the window), which also removes the
column-offset realignment of sort and filter indices on the backend.

Addresses #17835.
The post-load column auto-size rebuilds the header row, which would tear down
an open per-column filter editor (a popup, or the inline text-filter input)
while the user was still typing into it. Defer that rebuild while a header
editor is open and flush it once the editor closes, so keystrokes typed into a
filter immediately after opening a wide frame are not lost.
The per-column filter test opened its retry loop with inputValue() on the
text-filter input before the editor existed, blocking ~10s on the action
timeout each load. Probe with count() (instant) and wait for the initial row
batch before opening the filter; the test body drops from ~12s to ~2s.

Also document how to profile a slow Playwright test (force a trace, then pair
the before/after events in test.trace by callId) in the e2e README and the
run-playwright-tests skill.
@kevinushey kevinushey added this to the Blue Plumbago milestone Jun 3, 2026
@kevinushey
kevinushey requested a review from gtritchie June 3, 2026 18:39
The global td background rule painted an opaque --grid-bg over the
sidebar stats table, so the .sidebar-col hover highlight stopped at the
expanded summary widget. Keep the stats cells transparent so the parent
background shows through.
The plain Reset View MenuItem rendered its label flush left while the
CheckableMenuItem reserves a 25px icon column, leaving Reset View looking
offset. Render its label through formatMenuLabel so it carries the same
icon column. Add a single-arg AppCommand.formatMenuLabel(String) overload
for this label-only case.
getActiveCellTd located the cell by the rsGridCell_<row>_<col> id, but
buildRow assigns that id only to the cell that is already active. So when
setActiveCell updated activeRow/activeCol and looked up the newly targeted
cell to mark it, the lookup returned null and .activeCell was never applied;
the highlight only reappeared once a later render pass (e.g. a scroll)
rebuilt the row and re-derived the class from activeRow/activeCol. Headers
were unaffected because getActiveHeaderTh resolves by column index.

Look the cell up by data-col-pos, which buildRow sets on every rendered
cell, so the highlight lands immediately. Regression from #17812.

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Guards the regression fixed in the previous commit: clicking or arrow-keying
a cell must apply .activeCell to the live cell immediately, not only after a
later scroll re-renders the row. Asserts on the class rather than the painted
outline so it does not depend on focus/compositing state.
@kevinushey
kevinushey merged commit d7cfb7b into main Jun 4, 2026
8 checks passed
@kevinushey
kevinushey deleted the bugfix/17835-pinned-columns-pagination branch June 4, 2026 03:05
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.

2 participants