Skip to content

feat(plotly)!: migrate maps to plotly.js 4 - #7408

Merged
FarhanAliRaza merged 14 commits into
reflex-dev:mainfrom
kr1shna-exe:feat/7002-plotly-map-migration
Nov 18, 2026
Merged

FarhanAliRaza merged 14 commits into
reflex-dev:mainfrom
kr1shna-exe:feat/7002-plotly-map-migration

Conversation

@kr1shna-exe

@kr1shna-exe kr1shna-exe commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #7002.

Plotly.js 4 removes the Mapbox traces used by rx.plotly.mapbox. Add rx.plotly.map for MapLibre figures and upgrade all bundles to 4.3.0. Existing Mapbox figures keep rendering in rx.plotly, rx.plotly.map and rx.plotly.mapbox through a rename until 1.0, so the app loads one Plotly.js version.

What changed

  • Add the MapLibre bundle with locale, reactive data and event support.
  • Deprecate rx.plotly.mapbox and Mapbox figures in Reflex 0.11.1 with removal scheduled for 1.0. rx.plotly.mapbox loads [email protected]; Plotly.js 3.7.0 is no longer a dependency.
  • Every Plotly component (and subclass) checks the figure for Mapbox traces or layout.mapbox* keys, including state updates. On a match it logs one browser warning and passes Plotly a copy with MapLibre trace types (scattermapbox → scattermap, etc.), subplot references and layout.mapbox* keys, in the figure and its animation frames. The user's figure is not changed. Templates, geojson, customdata and button arguments keep their names. Figures without Mapbox names pass through unchanged, so the warning stops once the user migrates.
  • Render a None state figure when layout or the default template is set; mergician threw on null and crashed the page (also on main).
  • Update dependency locks, migration documentation, news fragments and regression coverage.

Verification

  • Full unit suite at a19690c: 11,263 passed and 158 skipped with 73.75% coverage. The review follow-up passes all 20 focused unit tests; all 9 Node-dependent cases skip cleanly when Node.js is unavailable.
  • Plotly browser suite: 14 passed in development and production using Chrome. Covers migration warnings, loading figures, translated modern and legacy map controls, state updates and click callbacks.
  • Upgrade check: an app written on released Reflex 0.11.0 (plotly 6.9) with rx.plotly.mapbox (literal, state, density, choropleth, two-subplot, fr, animated px.scatter_mapbox, relayout buttons) and default rx.plotly (literal, state, mixed map + bar) Mapbox plots, rerun in the same folder on this branch. All eleven render with the same center, zoom, size, locale, click result and animation; buttons with mapbox.* relayout paths no longer act, as documented; .web/package.json keeps only Plotly.js 4.3.0.
  • Ruff lint, formatting, pyright reflex tests and changed-file pre-commit hooks passed.
  • All tracked Python files passed Pyright with the Linux platform setting. The macOS all-files hook reports six existing affinity API errors in unchanged Linux benchmark code; other hooks passed.

Deployment notes

All renderers use Plotly.js 4. Mapbox figures keep rendering through the rename until 1.0 and should migrate to MapLibre traces and layout.map. This is still a breaking change for some Mapbox code: Mapbox paths in buttons, sliders and templates no longer act, on_relayout data uses map.* keys, styles hosted by Mapbox (mapbox:// URLs) do not load and the access token is ignored. The docs list these changes. The migration guide also covers removed MathJax 2 support, Chart Studio options, source-reference attributes and changed rendering defaults.

Add a MapLibre component and retain the deprecated Mapbox bundle during migration. Upgrade the supported bundles and locales, document compatibility changes and cover both renderers in development and production.
@kr1shna-exe
kr1shna-exe requested review from a team and Alek99 as code owners October 4, 2026 15:12

@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 10 files

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge with the documented migration limits.

Summary

This PR adds MapLibre maps, upgrades Plotly.js to 4.3.0, and keeps older Mapbox figures rendering through a temporary rename.

  • MapLibre maps have a bundle that keeps locale and event support.
  • Legacy Mapbox figures keep rendering through a warning and name conversion.
  • All Plotly component bundles move to Plotly.js 4.3.0.
  • A missing figure no longer breaks charts with layout settings.
  • The dataset source note appears without its chart icon.

kr1shna-exe documents the accepted limits: old Mapbox paths in controls and templates are not translated, and Mapbox-hosted styles no longer load. The latest edits make those limits clearer. No new actionable issues found.

Reviews (13) · Last reviewed commit: "docs(plotly): list the Mapbox code that ..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 6.83%

2 warnings

⚠️ 13 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 2 improved benchmarks
✅ 144 untouched benchmarks
⏩ 8 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_var_access[mutable_dataclass_list] 139.6 ms 128.8 ms +8.39%
⚡ test_proxy_list_mutation 9.8 ms 9.3 ms +5.3%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing kr1shna-exe:feat/7002-plotly-map-migration (86e8aba) with main (9a42f40)

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

@masenf masenf added documentation Improvements or additions to documentation breaking Public API facing change considered for minor release bump pre-v1.0 labels Oct 6, 2026

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

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

View guided diff | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P2 Incomplete create docstring packages/reflex-components-plotly/src/reflex_components_plotly/plotly.py:584 ▶

    The type-checking definition of PlotlyMapbox.create accepts *children and **props and returns a component, but its docstring is only one line. The repository requires Google-style docstrings with applicable Args and Returns sections. Please complete this docstring before merging.

                """Create a deprecated Plotly Mapbox component.
    
                Args:
                    *children: The children of the component.
                    **props: The properties of the component.
    
                Returns:
                    The Plotly Mapbox component.
                """
    

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@FarhanAliRaza FarhanAliRaza added the enhancement Anything you want improved label Nov 12, 2026 — with ChatGPT Codex Connector
@FarhanAliRaza FarhanAliRaza added the on deck PRs lined up to review / merge next label Nov 12, 2026
mergician threw on a null figure, so a state figure that starts as None
crashed the page whenever layout or the default template was merged.
Fall back to an empty object and cover the default template in the
migration warning test.
# Conflicts:
#	docs/app/reflex.lock/bun.lock
#	docs/app/reflex.lock/package.json
#	packages/reflex-components-plotly/src/reflex_components_plotly/__init__.py
#	pyi_hashes.json
Pin every Plotly.js 4 bundle, the locales and the docs lockfile to the
current 4.3.0 so the outdated-dependency check does not flag them once
the hold is gone. Date the rx.plotly.mapbox deprecation to 0.11.1, the
next release after v0.11.0, and fold the Mapbox browser warning note
into the breaking-change fragment.
Drop the Plotly.js 3.7 Mapbox bundle. The deprecated rx.plotly.mapbox now
loads [email protected] and renames Mapbox traces, subplot
references and layout.mapbox keys to their MapLibre names until its
removal in 1.0.

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

All reported issues were addressed across 7 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

View guided diff | Re-trigger cubic

Move the rename into PlotlyMapbox so subclasses keep it, and walk the
whole figure: templates, animation frames and button arguments now use
MapLibre names too. Compare full strings in the plotly tests.

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

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

The default rx.plotly and its variants now detect Mapbox traces or
layout.mapbox keys, log one browser warning and rename the figure to
MapLibre names, the same as rx.plotly.mapbox. Mapbox figures keep
rendering until removal in 1.0.

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

All reported issues were addressed across 7 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Re-trigger cubic

Replace the deep walk with a rename of trace types, subplot references and
layout keys in the figure and its animation frames. Templates, geojson,
customdata, frame names and button arguments keep the user's names.

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

All reported issues were addressed across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread pyi_hashes.json Resolved
@FarhanAliRaza
FarhanAliRaza merged commit 549fb69 into reflex-dev:main Nov 18, 2026
180 of 182 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Public API facing change considered for minor release bump pre-v1.0 documentation Improvements or additions to documentation enhancement Anything you want improved on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to plotly.js 4.x (removes the mapbox traces rx.plotly.mapbox wraps)

3 participants