Skip to content

docs: warm-up idiom for still-lazy event accessors; reactable bridge docstring - #421

Open
cpsievert wants to merge 3 commits into
spike/plotly-selection-statefrom
docs-accessor-warmup
Open

cpsievert wants to merge 3 commits into
spike/plotly-selection-statefrom
docs-accessor-warmup

Conversation

@cpsievert

Copy link
Copy Markdown
Collaborator

Stacked on the plotly selection-state PR (which makes selected()/brushed() state accessors; this PR's render_plotly note is scoped accordingly).

Summary

  • render_plotly docstring: warm-up note + minimal @reactive.effect snippet, scoped to the accessors that still attach on first read (clicked(), selecting(), brushing(), relayout()). selected()/brushed() attach at render and don't need it.
  • render_ipyleaflet docstring: same note for clicked() (also serves render_leafmap's ipyleaflet backend).
  • shinywidgets/_reactable.py module docstring: no longer claims "nothing is subscribed and no traffic flows until an accessor is read" — with feat: state-kind accessors attach eagerly at render by default #412, state-kind accessors attach at render. It now describes reality: the bridge binds once per model at render with one shared onStateChange subscription, and each accessor emits only its key slice.

Audit (done on this branch): no renderer docstring mentioned lazy attach before; the repo has no shinychat/querychat/chatlas examples; the only example reading an event accessor (examples/mols2grid) is safe (clicked is eager=True). Renderers still missing the note, for possible follow-up: bokeh (recommended next), matplotlib, ipydatagrid, lonboard, ipyaladin, niivue.

Verification

selected()/brushed() became state accessors on the parent branch (they
attach at render and seed the current selection), so the warm-up idiom
now applies only to clicked()/selecting()/brushing()/relayout().

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block these documentation-only changes.

No open issues 🎉

What changed in this PR

This documentation-only PR explains how to capture early interactions with lazy event accessors and updates the reactable bridge description to reflect eager state-accessor attachment.

Changes:

  • Adds startup warm-up examples for ipyleaflet’s clicked() and Plotly’s still-lazy event accessors.
  • Clarifies that Plotly’s selected() and brushed() attach at render and need no warm-up.
  • Corrects the reactable docstring to describe its shared subscription and per-accessor state slices.
File Description
shinywidgets/​_render_widget.py Documents warm-up patterns for lazy ipyleaflet and Plotly event accessors.
shinywidgets/​_reactable.py Updates the bridge docstring to describe eager attachment and subscription sharing.

Review effort: Balanced

@cpsievert
cpsievert marked this pull request as ready for review November 4, 2026 19:26
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