Render rx.plotly's id as react-plotly.js's divId - #7082
Conversation
react-plotly.js only forwards divId (plus style, className and ref) to the container div it renders; the framework-universal id prop fell into Plot's rest props and was silently dropped, so document.getElementById never found the chart. Map id to divId when rendering the tag. Fixes reflex-dev#6977
|
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Merging this PR will degrade performance by 3.63%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_isinstance_container[list_typeddict] |
103.6 ms | 107.5 ms | -3.63% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing Ishkirat-Singh:fix/plotly-id-div-id (1ea4ebd) with main (e34899f)
Footnotes
-
8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
@FarhanAliRaza thanks for the pyi hash commit and for resolving the conflict. The three red checks look unrelated to this diff:
Your two pushes also dismissed the approval, so it needs re-approving when you get a chance. |
All Submissions:
Type of change
Description
closes #6977
rx.plotly(..., id="the-plot")never reached the DOM. react-plotly.js'sPlotonly forwardsdivId(plusstyle,classNameandref) to the container div it renders, and the frameworkidprop that Reflex passes falls into its...eventPropsrest and is dropped.Plotly._rendernow moves theidprop todivIdon the rendered tag, using the existingTag.remove_propsandTag.sethelpers, sodocument.getElementById(...)finds the chart. Nothing is emitted when noidis given, and only the rendered tag changes; the component's ownidfield is untouched.Changes To Core Features:
Tests:
tests/units/components/graphing/test_plotly.pygains a case asserting theidis rendered asdivIdand one asserting nodivIdappears without anid. Ran the file locally, plus ruff and pyright on the touched files. Towncrier fragment inpackages/reflex-components-plotly/news/6977.bugfix.md.