Skip to content

Refactor example apps: FastAPI gallery + pure reflex-xy showcase#124

Merged
masenf merged 2 commits into
mainfrom
claude/session-chyc11
Jul 21, 2026
Merged

Refactor example apps: FastAPI gallery + pure reflex-xy showcase#124
masenf merged 2 commits into
mainfrom
claude/session-chyc11

Conversation

@masenf

@masenf masenf commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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.

Comment thread examples/fastapi/app.py Fixed
@codspeed-hq

codspeed-hq Bot commented Jul 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 94 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing claude/session-chyc11 (4b6742d) with main (79b0a3f)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the old iframe-based examples with FastAPI and Reflex showcases. The main changes are:

  • Adds a FastAPI chart gallery with live drilldown callbacks.
  • Rewrites the Reflex app around native reflex-xy data and event flows.
  • Removes committed chart HTML and the old demo app.
  • Updates browser smokes, packaging checks, tests, specs, and docs.

Confidence Score: 5/5

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

T-Rex T-Rex Logs

What T-Rex did

  • Validated that the before/after recordings use the same gallery → drilldown → zoom workflow.
  • Captured current-code evidence showing HTTP 200 responses for the gallery, drilldown, and three callback requests, and confirmed the final zoom window renders at 1100×430.
  • Observed a console message about a Chromium blocking the data: favicon redirect, and confirmed it did not affect tested surfaces or indicate changed behavior.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
examples/fastapi/app.py Adds FastAPI gallery routes and serializes concurrent first builds with per-chart locks.
examples/fastapi/live_drilldown.py Moves the live drilldown into the FastAPI example and falls back for malformed or non-positive point counts.
scripts/reflex_lifecycle_smoke.py Retargets the lifecycle smoke and checks every expected gallery frame individually.

Reviews (4): Last reviewed commit: "Address FastAPI example review feedback" | Re-trigger Greptile

Comment thread examples/fastapi/app.py
Comment thread scripts/reflex_lifecycle_smoke.py Outdated
Comment thread examples/fastapi/live_drilldown.py Outdated
Comment thread examples/fastapi/live_drilldown.py
Base automatically changed from agent/add-axis-scoped-zoom-examples to main July 21, 2026 18:48
masenf added 2 commits July 21, 2026 18:55
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.
@masenf
masenf force-pushed the claude/session-chyc11 branch from 586d5f0 to 4b6742d Compare July 21, 2026 19:00
@masenf

masenf commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

bringing this before it gets conflicted out again and so subsequent changes no longer have to touch the mountain of HTML files

@masenf
masenf merged commit 1e96e3c into main Jul 21, 2026
42 checks passed
FarhanAliRaza added a commit that referenced this pull request Jul 21, 2026
…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.
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.

2 participants