Skip to content

Fix live chart connection with Reflex 0.10 - #527

Merged
masenf merged 1 commit into
mainfrom
fix/xy-reflex-010-namespace-526
Oct 13, 2026
Merged

masenf merged 1 commit into
mainfrom
fix/xy-reflex-010-namespace-526

Conversation

@masenf

@masenf masenf commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #526.

Reflex 0.10 pre-creates the shared Socket.IO manager with autoConnect: false. XY inherits that setting, leaving /_xy inactive and live charts empty.

Activate the namespace explicitly when sharedSocket.active is false. The active guard matters: an already-open legacy manager can have its namespace handshake in flight, so an unconditional connect() sends a duplicate CONNECT. The cached-socket path stays unchanged, preserving app-owned reconnect timing.

Tests

  • Six real Socket.IO scenarios pass: warm manager, already-open warm manager, legacy auto-connect, already-open legacy manager, XY-first creation, and unhydrated tokens.
  • Covers binary payload dispatch, one shared transport, one namespace CONNECT, repeated mounts, app-owned reconnect/resubscribe, and last-mount cleanup.
  • Removing the fix reproduces failures in both warm-manager cases; the four other cases pass.
  • Pytest entry point passes; nine existing asset-contract tests pass in isolation.
  • node js/build.mjs, full-worktree Ruff check/format, and all pre-commit hooks pass.

The regression tests use real Socket.IO peers with React/DOM/ChartView stubs. Local browser painting and the full Python suite were blocked by Chromium's Unix socket restriction and the missing native Rust core, respectively. CI has since passed the repository's native and browser suites; a full compiled Reflex 0.10 app is not part of the new regression test.

CI results

All workflows passed on 08518ea7f75359117d8524703457846aae8c3210: CI, Docs, changelog, and CodSpeed.

  • Main Python suite: 4,348 passed, 110 skipped.
  • Python 3.11 suite: 3,966 passed, 128 skipped.
  • Rust: 137 passed.
  • Browser smoke, accessibility/cross-browser conformance, source distribution and platform wheel jobs passed.

Includes the design contract and a news fragment. Socket.IO test dependencies are development-only.

View guided diff Turn on auto-fix

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 831e6a2a-9563-4ffe-8f62-c280b3fee781
📥 Commits

Reviewing files that changed from the base of the PR and between 72a069f and 08518ea.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • news/526.bugfix.md
  • package.json
  • python/reflex_xy/assets/XYChart.jsx
  • spec/design/reflex-integration.md
  • tests/reflex_socket_connection.cjs
  • tests/test_reflex_socket_connection.py
 _______________________________________________________________________________________________________________________________________________________________________________
< The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. - Tom Cargill >
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 13, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 17.4%

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 109 benchmarks have no flame graph

The flamegraph could not be generated because we failed to resolve the symbols in the profiling trace. This happens when we fail to harvest information about language frames.

⚠️ 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

⚡ 15 improved benchmarks
✅ 94 untouched benchmarks
⏩ 2 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ ℹ️ test_zone_maps_pair 37 ms 27.9 ms +32.89%
⚡ ℹ️ test_zone_maps 19.6 ms 15.2 ms +29.31%
⚡ ℹ️ test_first_payload_scatter_medium 5.2 ms 4.3 ms +21.17%
⚡ ℹ️ test_build_scatter_medium_raw 5.4 ms 4.5 ms +20.35%
⚡ ℹ️ test_first_payload_polar_line 5.5 ms 4.6 ms +20.01%
⚡ ℹ️ test_first_payload_area_core_2d 9.5 ms 8.1 ms +16.83%
⚡ ℹ️ test_build_scatter_medium_pyplot 6.6 ms 5.7 ms +16.06%
⚡ ℹ️ test_build_payload 70.2 ms 61 ms +15.1%
⚡ ℹ️ test_first_payload_line_large 70.1 ms 60.9 ms +15.06%
⚡ ℹ️ test_build_line_large_raw 70.3 ms 61.1 ms +15.02%
⚡ ℹ️ test_first_payload_ingest_flavors[datetime64] 7.9 ms 7 ms +13.77%
⚡ ℹ️ test_first_payload_errorbar_large 516.2 ms 453.8 ms +13.75%
⚡ ℹ️ test_build_line_large_pyplot 86.8 ms 77.6 ms +11.8%
⚡ ℹ️ test_first_payload_density_large 90.4 ms 81 ms +11.66%
⚡ ℹ️ test_histogram2d_weighted_arbitrary_edges 98.9 ms 89.4 ms +10.56%

Tip

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


Comparing fix/xy-reflex-010-namespace-526 (08518ea) with main (72a069f)

Open in CodSpeed

Footnotes

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

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High impact] Adds Socket.IO dependencies and fixes chart connection logic.

The connection fix has no established blocking defect, but the required duration comment must be added before merging.

Findings

  1. P2 Python checks need extra setup ▶
  2. P2 Wait duration is unexplained ▶

Summary

The PR activates /_xy when Reflex creates the shared manager with automatic connection disabled.

  • Live charts connect through Reflex’s shared Socket.IO manager.

masenf acknowledged that browser painting was not checked because Chromium could not use Unix sockets. masenf also acknowledged that the full Python adapter suite needs the native Rust core.

Reviews (1) · Last reviewed commit: "Fix XY namespace activation with Reflex ..." · Reviewed by Greptile

Comment thread tests/test_reflex_socket_connection.py
Comment thread tests/reflex_socket_connection.cjs
@masenf
masenf marked this pull request as ready for review October 13, 2026 17:43
@masenf
masenf merged commit 5631f83 into main Oct 13, 2026
30 of 31 checks passed
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.

Charts never render with Reflex 0.10: the /_xy namespace socket is never connected

1 participant