Charts never render with Reflex 0.10: the /_xy namespace socket is never connected
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, python, react
Research direction
Start with XYChart.jsx and trace how xySocket() creates or reuses the Socket.IO namespace socket alongside Reflex’s createSocket in reflex_base/.templates/web/utils/state.js. Check the socket.io-client connection behavior described in the issue, then reproduce with Reflex 0.10. Done means the namespace connects and charts render with a canvas; verify the existing behavior on Reflex 0.9.13 remains intact.
Written by the indexing model from the issue text.
Description
Summary
With Reflex 0.10.0, every xy chart in a Reflex app renders empty: the chart's wrapper div mounts, the figure token arrives in state, but no canvas is ever created. Reflex 0.9.13 with the same app and xy[reflex]==0.0.7 renders normally.
Root cause
Reflex 0.10 creates its Socket.IO socket ahead of time with autoConnect: false (reflex_base/.templates/web/utils/state.js, createSocket, used for the "warm socket"). None of 0.9.8 to 0.9.13 does that.
XYChart.jsx's xySocket() deliberately shares Reflex's manager (same URL and path, so io() returns a namespace socket on the cached Manager). A namespace socket only opens itself when the manager was created with autoConnect on (if (this.io._autoConnect) this.open() in socket.io-client's Socket constructor). Because Reflex now creates the manager first with autoConnect: false, the /_xy namespace socket is never connected:
- no
40/_xyCONNECT packet ever goes out on the websocket; - with
localStorage.xy_debug = "1", the effect logseffect run {... hasEl: true}for every chart, but neverxy namespace connectednorxy connect_error; - every
subemit is buffered forever, so no figure payload arrives.
Reproduction
- A Reflex app using
reflex_xy.XYPlugin()and any live chart (figure=handle). reflex==0.10.0,xy[reflex]==0.0.7, Chrome.- Open a page with a chart: the container is empty and
document.querySelectorAll("canvas").length === 0. - Downgrade to
reflex==0.9.13: the charts render.
Suggested fix
Connect the namespace explicitly instead of relying on the shared manager's autoConnect, e.g. in xySocket():
sharedSocket = io(nsUrl.href, { /* unchanged options */ });
sharedSocket.on("connect", () => dbg("xy namespace connected"));
sharedSocket.on("connect_error", (e) => dbg("xy connect_error", String(e)));
if (!sharedSocket.connected) sharedSocket.connect();
return sharedSocket;
connect() is a no-op on an already-active socket, so this is safe whichever side creates the manager first.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 75
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reflex-dev/xy
-
Skip finite/log visibility scans when zone maps already prove all-finite on linear axesMay be free again A pull request for this issue was closed without being merged. Openneeds investigate performance
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
reflex-dev/xy#169 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
reflex-dev/xy#523 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
reflex-dev/xy#516 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
reflex-dev/xy#512 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
reflex-dev/xy#511 ·
Maintainers usually reply within 1 day
Similar issues
-
effort: low prio: low ready
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
digitalfabrik/integreat-cms#4616 ·
Maintainers usually reply within 5 days
-
bug difficulty:2 good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MakazhanAlpamys/Soup#1865 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FinanceFlash/unvibecode#233 ·
Maintainers usually reply within 1 day
-
area: agents area: docs good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exemptPossibly taken @adityasinha-ghub claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pylint-dev/pylint#11656 ·
Maintainers usually reply within 1 day