reflex-dev / reflex-dev/reflex
`rx.Field` setter decorators with frontend compilation support
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 28.9k
- Forks
- 1.8k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 170
Description
Summary
Implement @field_name.setter decorator on rx.Field descriptors that auto-generates an event handler to set the var. For simple cases, rx.Field(..., setter=True) creates a default setter that assigns the value directly.
Frontend Compilation
Because these setters have trivial, known semantics (assign a value to a field), they can be compiled to JS that runs on the frontend. This is the bridge to Replicache optimistic mutations (1b-ii) — the frontend applies the setter immediately as a local mutation while the backend mutation is in flight. The user sees instant feedback with no round-trip.
For custom setters (@field_name.setter decorated functions), the same pattern applies if the setter body is simple enough to cross-compile. More complex setters fall back to backend-only execution with the optimistic mutation reverted on conflict.
Related
Addresses #3772 (rx.var / property setters).
Part of the Reflex Framework Roadmap — Section 1k.
Contributor 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.
Research direction
Start by locating the rx.Field descriptor and the frontend compilation entry points; the issue names no files or tests. Trace how setter decorators and default setters should create event handlers, then identify how simple setters can compile to JavaScript while complex setters remain backend-only. Done means both setter forms work and the optimistic frontend behavior matches the stated fallback semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- backend, compilers, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100