Skip to content

Opt in plotly selected()/selecting()/hover(); ~4x slimmer selection payloads - #484

Open
cpsievert wants to merge 10 commits into
listen-to-opt-infrom
plotly-slim-selections
Open

cpsievert wants to merge 10 commits into
listen-to-opt-infrom
plotly-slim-selections

Conversation

@cpsievert

@cpsievert cpsievert commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #483; split out of #480. Together with #481, closes #459.

plotly's selected(), selecting(), and hover() are now opt-in via listen_to. The bind message declares a per-event payload shape (region vs points, unioned in JS with points winning): brushed()/brushing() bind region, selected()/selecting() bind points. Opted-in selection frames report {trace_index, point_index, customdata?} instead of duplicating x/y (~90 → ~25 bytes/point); selected_rows() is unaffected, and the seed path skips building points entirely when only the region is wanted. An app that only reads brushed() receives a few hundred bytes of selection region instead of tens of MB of points.

Known limitation, addressed by the stacked PRs #487 and #488: plotly.py's own FigureWidget mirrors every selection unconditionally (#479). Until those land, the size guard (#481) keeps it from killing the session.

@cpsievert

Copy link
Copy Markdown
Collaborator Author

@copilot please re-review

Copilot AI commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@copilot please re-review

Re-reviewed the six commits. One documentation issue: _render_widget.py:4643–4646 promises client-side oversized-message dropping and SHINYWIDGETS_WS_MAX_SIZE, but that functionality is in separate PR #481, not this branch. Those claims should be conditional on #481 landing; large FigureWidget selections can still disconnect without it.

No other high-confidence regressions found in the opt-in/slim-payload changes. Python CI jobs passed; the failing browser job is the unrelated jscatter click-after-lasso test. No files changed.

The dropped-client-side behavior and SHINYWIDGETS_WS_MAX_SIZE env var land
in #481, not this branch; describe the actual disconnect-and-raise-limit
behavior (matching the itables docstring).
@cpsievert

Copy link
Copy Markdown
Collaborator Author

@copilot please re-review. Fixed the docstring issue you found: 1ac120c removes the client-side oversized-message-dropping / SHINYWIDGETS_WS_MAX_SIZE claim from the render_plotly docstring (that behavior lands in #481).

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

@copilot please re-review. Fixed the docstring issue you found: 1ac120c removes the client-side oversized-message-dropping / SHINYWIDGETS_WS_MAX_SIZE claim from the render_plotly docstring (that beha...

Verified 1ac120c4 resolves the docstring issue. Re-reviewed the seven commits and found no additional high-confidence bugs or regressions. Base-branch CI and the previous branch run are green; CI for 1ac120c4 is still running. No files changed.

selected() is opt-in (listen_to), so the intro example raised as written.
Without listen_to, plot.selected() raises under the opt-in, so the test's final
'selection reaches Python' check passed on an error string. With it, the
bridge's own points message is what trips the size guard.

This branch has not been deployed

No deployments
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.

Oversized widget-to-server messages disconnect the session (plotly selections, jscatter lassos)

2 participants