Repository navigation
feat(interactive): add list viewer, text, and reset controls for list outputs - #1835
Conversation
eitsupi
left a comment
There was a problem hiding this comment.
Reviewed with ChatGPT, including the interaction with #1828 and the List Viewer design introduced in #1741.
Overall, I like this direction: sharing the existing List Viewer implementation between panels and Interactive cells, while routing live inspection to the session that produced the cell, looks appropriate.
I found one issue that I think should be addressed before merging:
- Interactive list roots currently use
listview_state(value, "List", "List"). Since the existing viewer registry usesownerto reuse viewers belonging to the same top-level object, all Interactive list cells would share the same"List"owner. Nested viewers from different cells could therefore reuse the same viewer state. I think the owner should be unique per Interactive list root, e.g. based on itsview_id, with a regression test covering two cells opening nested viewers.
There is also some overlap with #1828. That PR currently adds panel focus/blur handling inside getListViewerScript(), while this PR substantially rewrites that function. When rebasing/merging #1828 afterward, I think those hooks should remain in the panel-specific wrapper rather than createListViewer(), since the latter is now also used by notebook cells.
One non-blocking concern is lifetime management: each plain list result is retained in .sess_env$dataviews for lazy browsing, but Interactive outputs do not appear to dispose that state when their live generation becomes obsolete. This may be worth handling separately together with the existing Interactive Data Viewer state lifecycle.
|
Thanks @eitsupi. The shared owner did cause nested table panels from different Interactive cells to reuse and overwrite the same viewer state. Fixed in f1968b6: each list root now uses Added a real-R regression with two separate cells, each containing two nested tables. It checks that the cells receive distinct table viewer IDs, tables within one cell still reuse that cell's panel, and opening another table in either cell preserves the other cell's data. The test reproduced the collision before the fix and passes afterward. The neighboring list/reconnection test, build, TypeScript compilation, lint, diff checks, and bundled-source identity checks also pass. Agreed about #1828: focus/blur hooks should stay in the panel-specific I also agree that retained-state cleanup should be handled together with the existing Interactive Data Viewer lifecycle. That non-blocking follow-up remains outside this fix. |
Unclassed list results in Interactive cells currently appear only as console text. Render them with the shared list viewer introduced in #1741, including lazy expansion, paging, breadcrumbs, and buttons to open the larger List viewer or switch to the ordinary R Text printout without rerunning code. Lists with custom classes retain their existing printing behavior.
Retain the first page and printed text for saved or disconnected output, and route live browsing to the session that produced the cell. Add Reset to both the cell and larger viewer: it returns to the initial path, collapses rows, resets scrolling, clears navigation history, and discards pending page responses.
Plain numeric item summaries show up to five values at three significant digits, with an ellipsis only when more remain. For example,
num [1:10] -1.33 -0.0828 0.836 1.23 -2.35 ...gives a useful preview without scanning the whole vector. Individual rows in an opened vector retain full numeric precision, and class-specific formatting is preserved.Validation:
Existing Interactive sessions need to be restarted to use the new R output handler.