reflex-dev / reflex-dev/reflex

`rx.Field` setter decorators with frontend compilation support

Open
#6,230 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.