Skip to content

Render rx.plotly's id as react-plotly.js's divId - #7082

Open
Ishkirat-Singh wants to merge 4 commits into
reflex-dev:mainfrom
Ishkirat-Singh:fix/plotly-id-div-id
Open

Render rx.plotly's id as react-plotly.js's divId#7082
Ishkirat-Singh wants to merge 4 commits into
reflex-dev:mainfrom
Ishkirat-Singh:fix/plotly-id-div-id

Conversation

@Ishkirat-Singh

@Ishkirat-Singh Ishkirat-Singh commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Description

closes #6977

rx.plotly(..., id="the-plot") never reached the DOM. react-plotly.js's Plot only forwards divId (plus style, className and ref) to the container div it renders, and the framework id prop that Reflex passes falls into its ...eventProps rest and is dropped.

Plotly._render now moves the id prop to divId on the rendered tag, using the existing Tag.remove_props and Tag.set helpers, so document.getElementById(...) finds the chart. Nothing is emitted when no id is given, and only the rendered tag changes; the component's own id field is untouched.

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Tests: tests/units/components/graphing/test_plotly.py gains a case asserting the id is rendered as divId and one asserting no divId appears without an id. Ran the file locally, plus ruff and pyright on the touched files. Towncrier fragment in packages/reflex-components-plotly/news/6977.bugfix.md.

Review in cubic

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
@Ishkirat-Singh
Ishkirat-Singh requested a review from a team as a code owner September 10, 2026 22:24

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no outstanding correctness or repository-rule issues.

Summary

  • Removes the unsupported id from the rendered Plot tag and replaces it with divId.
  • Leaves components without an ID unchanged.
  • Adds regression coverage for both cases.
  • Adds the required package news fragment and updates the generated stub hash.

Reviews (4) · Last reviewed commit: "Merge upstream/main into fix/plotly-id-d..."

Comment thread packages/reflex-components-plotly/src/reflex_components_plotly/plotly.py Outdated
FarhanAliRaza
FarhanAliRaza previously approved these changes Sep 11, 2026
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@codspeed-hq

codspeed-hq Bot commented Sep 11, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.63%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 39 untouched benchmarks
⏩ 8 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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.

@Ishkirat-Singh

Copy link
Copy Markdown
Contributor Author

@FarhanAliRaza thanks for the pyi hash commit and for resolving the conflict.

The three red checks look unrelated to this diff:

  • check (reflex, 3.10) / check (reflex, 3.14) fail at "Check minimum declared dependency versions", reporting reflex_base.otel and reflex_base.utils.deterministic_hash as unresolvable. That run started at 20:34, between the sibling publishes at 20:27 and v0.9.11 at 20:38. codex/merge-back-0.9.11 passed the same job at 20:50, and uv run python scripts/check_min_deps.py --python 3.10 reflex passes locally on this branch. A re-run should clear it.
  • CodSpeed flags test_isinstance_container[list_typeddict] at -3.63%, with its own "Different runtime environments detected" warning and 39 benchmarks untouched. That benchmark only exercises reflex_base.utils.types._isinstance; this PR changes Plotly._render, one unit test, a news fragment and one line of pyi_hashes.json.

Your two pushes also dismissed the approval, so it needs re-approving when you get a chance.

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.

rx.plotly silently drops the id prop (react-plotly.js expects divId)

2 participants