Skip to content

Rewrite the docs - #1052

Open
Archmonger wants to merge 178 commits into
mainfrom
new-docs
Open

Archmonger wants to merge 178 commits into
mainfrom
new-docs

Conversation

Comment thread .github/workflows/.hatch-run.yml
Handlers must be coroutines now, so each example hoists its one-liner into a
named 'async def' (or a factory), reads event data with 'await event.<path>',
and batches sibling reads through 'event.read(...)' or asyncio.gather so the
round trip is paid once.
The event your handler receives is a live proxy, not a payload, so the pages
which still described a serialized snapshot are rewritten around it:

- handlers are coroutines, and the failure shapes are separated (coroutine
  object -> attribute fall-through -> orjson TypeError on send, vs. a real
  None from a non-handler); 'synchronous handler' and 'may be async def'
  leftovers in the state pages are gone
- reads are awaited, batched with read()/gather, never subscripted; a missing
  await yields a truthy proxy rather than None, and hasattr() on a proxy always
  lies
- debounce coalesces client->server events (it never paced server values), the
  server echo is the per-event _reactpy_ack_seq mapping, the target prefix is a
  key path and not the patch path, and the six model keys come from
  types.ALLOWED_VDOM_KEYS rather than the wire schema
- partial with a bound leading argument defeats bytecode detection and changes
  the handler's arity - corrected in the handler page and the tutorial
- client-api covers how handleIncoming answers event-proxy-request itself, and
  the stopImmediatePropagation wire key is documented
@Archmonger
Archmonger marked this pull request as ready for review October 18, 2026 19:34
Scoped to projects that depend on the reactpy package: dropped the docs
house-style section, PR/commit provenance, test-file and docs/examples
citations, and the docs-authoring framing.

Added the deployment and integration layer that was absent: install and
extras, ASGI serving, all three executors with real signatures, Jinja
tags, reactpy.reactjs npm components, custom ASGI wiring, config,
debugging symptoms, and Layout-based testing.

Corrected claims inherited from the previous revision against src/:
no tuple handler-option form, handler bytecode is inspected for
preventDefault/stopPropagation/debounce, debounce is client->server and
input-only, attribute values are unvalidated in v2, Layout takes a
component instance, and bare @use_effect does not infer dependencies.
The affected pages now teach the rules by what actually happens at runtime —
shifted state slots, a silent stale dependency, an Effect that re-runs — and
point at the Layout-based test that proves them, rather than at anything
outside ReactPy.
Adds the deployment surface an external project needs (install and extras,
ASGI serving, the three executors, Jinja, npm components, config, testing)
and keeps only what a dependent project has to know.

Corrects details against src/, several of them measured: no tuple
handler-option form, preventDefault/stopPropagation/debounce are detected in
handler bytecode, debounce is client-side and input-only, attribute values
are unvalidated, Layout takes a component instance, and a bare @use_effect
infers dependencies rather than pinning them.
- @use_effect: the decorator infers dependencies; it is not dependencies=[],
  and @use_effect() with empty parentheses re-runs every render (measured)
- the async-def rejection message keeps its backticks, and its text reaches
  the model only under REACTPY_DEBUG; an effect-body error is logged at
  unmount, not at mount
- use_async_effect does not validate that the effect is a coroutine
- Location.query_string keeps the leading "?" the client forwards
- the path_prefix ValueError quotes `path_prefix` with backticks
- a component returns one value: return [a, b] renders the list repr
- Changed image URLs in various Python and HTML files to point to local assets instead of external links.
- Updated paths in examples related to sculptures, components, and demos to ensure they reference the correct local image files.
- Added a check in the build process to validate asset paths, preventing broken images due to incorrect relative paths.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment