Refactor example apps: FastAPI gallery + pure reflex-xy showcase#124
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR replaces the old iframe-based examples with FastAPI and Reflex showcases. The main changes are:
Confidence Score: 5/5This looks safe to merge. Concurrent requests for one chart share a per-chart build lock. The lifecycle smoke checks exact iframe routes and waits for each frame to paint. Invalid point-count settings no longer abort app import. No blocking issues were found in the updated fixes.
What T-Rex did
Important Files Changed
Reviews (4): Last reviewed commit: "Address FastAPI example review feedback" | Re-trigger Greptile |
Replace the old iframe-based examples/reflex app (which committed ~25 static chart HTML files) and remove python/reflex-xy/examples/demo_app. - examples/fastapi: a new FastAPI app that generates chart HTML with chart.to_html() and serves a 100M-point drilldown through a POST callback route, showing xy from a non-Reflex stack. - examples/reflex: rewritten as a pure reflex-xy showcase of the ways to link chart data (figure vars, static Chart tier, inline() token) plus reflex-native features: charts driven by state vars, hover/click/select event handlers, streaming via reflex_xy.append, and data recomputed from the on_view_change event. - Both apps show each example's source via inspect.getsource in on-page code panels, and each has its own pyproject.toml so it runs with `uv run`. - Retarget the lifecycle and visual browser smokes to run examples/fastapi with `uv run` and drive Chromium at its routes. - Update packaging (sdist include, verify_sdist), the coupled tests, specs, and docs to match. No static chart HTML is committed or packaged.
- Stop reflecting the requested chart id into 404 HTML on /chart/{id}
and /code/{id}; raise HTTPException so the response is a JSON error
(removes a reflected-XSS sink).
- Replace @cache on _chart_html with a per-id lock cache so concurrent
first requests for the same chart build the payload once instead of
duplicating a large allocation under the threadpool.
- Validate XY_LIVE_POINTS: a non-integer or non-positive value falls
back to the default with a warning instead of aborting app import or
failing deep in data generation.
- Tighten the lifecycle smoke index check: require every gallery route
to be embedded and to paint. Each iframe is scrolled into view and
checked individually so a page holding more charts than the browser's
live WebGL context cap still verifies all of them.
586d5f0 to
4b6742d
Compare
|
bringing this before it gets conflicted out again and so subsequent changes no longer have to touch the mountain of HTML files |
…lete-reflex-events-and-cross-filtering-in-xy Conflict resolutions beyond textual merges: - XYChart.jsx onPayload: adopt main's in-place ChartView.updatePayload fast path while keeping this branch's republish restore contract — on an in-place swap the wrapper pins the viewport (clearing the domain interpolation, as the kernel append path does) and re-requests the selection mask; the ghost overlay now covers only the rebuild path. - 56_animation.js updatePayload recomputed pickability with the old static formula; route it through _updatePickable() so the modebar Select trigger stays in sync (semantic conflict with this branch's dynamic-pickability work). - Accept main's removal of python/reflex-xy/examples/demo_app (#124) and port its unique pieces into examples/reflex: v1 event envelopes in the showcase handlers (data/canonical_row_id/modifiers, selection total_count/data_bounds, view x_domain — the flat pre-#113 shapes no longer arrive), the handler-revision republish stress test with event counters, and the README interaction contract checks. - Specs updated to match: reflex-integration.md documents the in-place republish restore; interaction.md adds the updatePayload call site to the _updatePickable funnel.
Replace the old iframe-based examples/reflex app (which committed ~25 static chart HTML files) and remove python/reflex-xy/examples/demo_app.
uv run.uv runand drive Chromium at its routes.