Repository navigation
Releases
reflex-workflow@0.0.1a1
Breaking Changes
- A wait's deadline now decides when the wait ends: once it has passed,
deliverrefuses the event and returns 0, even where no worker has reached the timeout step yet. Previously an event landing in that window won and the timeout's work was discarded, which let a caller delivering faster than the workers pass keep a deadline from ever being kept. An answer arriving just after the deadline is now refused rather than taken late. (#7288) - Require Python 3.11 or newer; Python 3.10 is no longer supported. (#7449)
Features
run_workflows(suspends_when_idle=True)is for a database that stops itself when nothing is querying it and charges for being up, such as Neon: the worker listens for nothing, because a heldLISTENis a connection such a database counts as work, and waits an hour between looks rather than thirty seconds. Measured on Neon, an idle worker with a listener never let compute suspend; without one it suspended five minutes after the last query. (#7288)- A workflow can declare
__workflow_limit__ = Limit(by="customer", at_most=3)to cap how much of one group runs at once, counted across every worker. Workers also take their tables in turn and share each pass between them, so a table with a backlog no longer holds up the rest. (#7288) - Map
AttemptLogonto your base and the engine records what each step attempt did — the step, the attempt number, the outcome, the error and how long it took — readable withawait run.history(). Each record is written in the same transaction as the step it describes. (#7288) connect_workflows(Session)sets up a process to start runs, deliver events and read their state without running any steps, so a web process no longer has to start a worker it does not want. (#7288)- Add
reflex-workflow, a prototype of durable workflows where each workflow is a SQLAlchemy table and workers in the app run its steps on Postgres. (#7288) - A step can return
fan_out(children, then=step)to run many child runs at once and carry on when the last one finishes. Each child is an ordinary run with its own retries and errors, andself.children(Child)reads them back. (#7288) Limitnow also says how often a group may start:Limit(by="provider", at_most=5, rate=60, per=timedelta(minutes=1)). Rates count in a token bucket that refills continuously, in a table the application maps withRateBucket. (#7288)- A workflow whose own attribute takes one of the engine's column names — a
parentrelationship, or a column of that name holding something else — is refused where it is declared, instead of failing on the firststart()or the first claim. (#7288) - Workers hear about new work through Postgres
LISTEN/NOTIFYrather than waiting for their next poll, so a run started or an event delivered by another process is picked up straight away. Polling remains the fallback. (#7288) - Runs can wait and repeat: a step returns
wait_for(step, timeout=..., on_timeout=...)to
park untildeliver(...)hands it an event, orevery(step, schedule)to run again on an
interval or aCron("0 9 * * MON-FRI", "America/Los_Angeles")expression. (#7288) @step(lane="media")keeps a step on the workers started to serve that lane, withrun_workflows(..., lanes=["media"]). Heavy work can have its own machines while ordinary steps run anywhere, and a worker skips tables it can run nothing of. (#7288)run_workflows(on_idle=...)reports the instant a worker is next waiting for, on the database's clock and only when it changes, andreflex_workflow.wake(timeout)makes the worker in this process look now and holds until it has nothing left to take. Together they let a platform wake a deployment that suspends when idle, so its timers fire without anyone visiting the app. (#7288)- Workflows can be mixed into models on a
MappedAsDataclassbase by importingWorkflow,AttemptLogandRateBucketfromreflex_workflow.dataclass, which SQLAlchemy 2.1 requires and 2.0 warns about. The engine's columns stay out of the constructor, so a model reads as it did before the mixin was added. (#7288) - Steps are traced with OpenTelemetry when
reflex-otelis instrumented: every attempt gets a<table>.<step>span linked to the handler, request, or step that scheduled it, with the attempt number, outcome, and error on it. Step arguments and row columns are never recorded, beyond what a failed attempt's exception message quotes. (#7635)
Bug Fixes
- A rate-limit group too long to name in the bucket key is named by a digest of itself, rather than failing the insert; a group the engine cannot claim no longer stops the rest of its table from being claimed. (#7288)
cancel()no longer stops a run that began matching its predicate after it had read the rows to stop. Such a run was cancelled without its parent being told, leaving a fan-out waiting for a child that would never report. (#7288)- An event
keyis remembered when the run runs the event, not when it is buffered, so a resend of an event the run discarded unrun is accepted instead of being refused forever. A run going round anevery(...)schedule no longer holds a buffered event it will never reach, which used to refuse every later delivery. (#7288) cancel()over a large backlog no longer fails once the rows it matches would exceed a statement's parameter limit. It picks and stops them in one statement now, which is also one round trip rather than two. (#7288)start()stores a column the caller set toNoneasNone, rather than falling back to the column's default.deliver(..., restart=True)leaves a cancelled step its lease, asrun()does, so the restarted step waits for it instead of running beside it. (#7288)reflex_workflow.wakeno longer returns while a step the worker took is still running, or before the step it continued into has run, so a host that suspends when it returns does not stop that work midway. (#7382)- An event delivered while a run is running the event it held for a wait is now held for the run's next wait, instead of being refused and lost. A run that waits on the same step again, such as a conversation, no longer misses a message that arrives during that step. A second answer to a wait whose held event has not been taken yet is still refused. (#7396)
Performance
- An idle worker now waits the same whether or not it can listen for notifications, and a listener that cannot reconnect backs off up to
max_idle_intervalinstead of retrying every second. A database that suspends itself when nothing is querying — Neon, and other managed Postgres — is no longer held awake by a worker with nothing to do. (#7288) - Claiming from a limited table and asking when work is next due now read indexes rather than scanning the table. On a 700k-row table with 500 groups a claim took 11.7s and is now 5ms, and the idle question 18ms and is now 1ms. Workflow tables gain an
ix_<table>_leaseindex, so autogenerate a migration after upgrading. (#7288)
Documentation
- The README covers using workflows from a Reflex app: why they go on their own
DeclarativeBaserather thanrx.Model, registering that base soreflex db makemigrationspicks the tables up, and the session factory to giverun_workflows. (#7288)
Miscellaneous
- Type-check cleanly against SQLAlchemy 2.1. (#7645)
v0.10.1
Breaking Changes
router.session.client_ipnow ignores untrustedX-Forwarded-Forheaders by default. Configuretrusted_proxy_hopsto use forwarded client addresses from a trusted proxy chain. (#7614)
Features
-
Add an experimental, default-off
react_compilerconfiguration flag to enable React Compiler memoization for generated components in development and production. (#7234) -
Form
on_submithandlers can annotate their form data asrx.form.FormDatato receive every value of fields that share a name, in submission order; adictannotation still keeps each name's last value. In aTypedDictannotation, alist[str]field collects every value of its name and aboolfield isFalsewhen nothing was submitted, such as for an unchecked checkbox, or when the value is false-like, such as"false","off"or"0"; forlist[str] | Noneandbool | Nonefields an unsubmitted value isNone, and an unsubmittedNotRequiredfield is left out. In aTypedDict, a list fieldrangealso collects therange[]values a two-thumbrx.slider(name="range")submits.@rx.event def handle_submit(self, form_data: rx.form.FormData[str, str]): self.toppings = form_data.getlist("topping") ``` ([#7386](https://github.com/reflex-dev/reflex/issues/7386))
-
A page's
on_loadaccepts any sequence of events, e.g. a tuple, like a list of them. (#7402) -
Detect a frontend built for another version of the app when it connects to the backend. The compiled frontend now carries a hash of the state tree (state names, frontend vars and event handler names) and sends it on every socket connect. On a mismatch, a production page reloads once (sharing the
REFLEX_AUTO_RELOAD_COOLDOWNwith the reload on frontend errors) and otherwise shows a "new version available" banner with a reload button; in dev mode it only logs a console warning. Load balancers serving several backend versions still need sticky sessions. (#7553) -
Expose
rx.moment_providerfor sharing locale, timezone, formatting, and timer defaults across Moment components. (#7591)
Bug Fixes
- Use atomic writes and OS locks to protect shared JSON metadata from concurrent Reflex processes. When locks are unavailable (for example, with a read-only
REFLEX_DIR), writes remain atomic but concurrent updates may overwrite each other. (#7052) - Load backend apps by their configured module name so state updates work even when the app package has no
__init__.py. (#7258) - A
stateful_pages.jsonmarker that is not valid UTF-8 is now treated as corrupt and rebuilt, instead of raisingUnicodeDecodeErroron every backend start. (#7404) - Type checkers see the database helpers of
reflex.model(rx.session,rx.asession,rx.Model,ModelRegistry, ...) as defined, rather than as unions with the stand-ins used when the db extra is missing. (#7406) - Fix a global
rx._x.client_statereader that mounts after the value was set, such as one behind anrx.cond, keeping the stale value when the value is later set back to its default. (#7407) - Fix
TypeError: refs._client_state_set... is not a functionwhen the backend pushes a globalrx._x.client_statevalue before any component using it has mounted, such as one behind anrx.condor a page that waits for hydration. The value is now kept for the first component that mounts. (#7407) - Fix unawaited coroutine warnings when a state delta filter withholds an async uncached computed variable. (#7410)
- Fix installing Reflex source distributions with uv by excluding references to workspace packages that are not included in the archive. (#7411)
- Cancel unfinished page-load event chains when the client disconnects, including hydration that has not yet started. Independent background events continue running. (#7415)
- The backend log for an unknown frontend substate now says the substate was skipped instead of reporting a failed state update. The frontend exception handler docs describe how to resolve the mismatch. (#7435)
reflex.model(andrx.ModelRegistry,rx.session,rx.Model) can be imported withoutgreenlet, which SQLAlchemy 2.1 only installs with itsasyncioextra; onlyrx.asessionandget_async_enginerequire it now. (#7440)- Detect state reads from the new shared state store when checking that an app that reads state defines an
rx.Statesubclass. (#7441) - Raise an actionable error when a legacy string passed to
App.modify_state()has a missing or unknown state path. Userx.BaseStateToken(ident=client_token, cls=StateClass)to select the state explicitly. (#7443) - Production exports,
reflex run --env prod, and preview startup that share a.webdirectory now wait for one another instead of overwriting each other's compiled frontend and archives. (#7453) - Mutating a nested value reached through
dict.values()ordict.items()on a state var now marks the var dirty, so the UI and cached vars depending on it update. (#7500) reflex runno longer logs "Unexpected exit from worker-1" when the dev backend is stopped with SIGTERM or SIGINT. (#7538)- Cap the automatically selected number of Redis-backed backend workers at eight. Set
GRANIAN_WORKERSto override the default. (#7542) reflex initno longer refuses to reinitialize an existing app just because its project directory is namedreflex; the check now applies to theapp_nameset inrxconfig.py. (#7554)- Add development frontend packages with
-D, so npm saves them underdevDependenciesand source-only hot reloads no longer reinstall frontend packages. (#7566) - Cached computed vars that depend on client storage (
rx.LocalStorage,rx.SessionStorage,rx.Cookie) are now evaluated once per page load instead of twice. (#7568) - A background task that re-enters an expired session now rehydrates the loaded state tree, so the browser no longer shows stale values for those states. (#7585)
- Repeated request headers are no longer collapsed to their last value: repeated
cookiefields are joined with"; "and any other repeated field with", ", sorouter.headers.cookiekeeps every cookie. (#7588) - Websocket connections now accept request header values containing bytes that are not valid UTF-8. (#7602)
- Avoid false type errors when hydrating or assigning strings to vars annotated with
Cookie,LocalStorage, orSessionStorage. (#7603) - Clarify the warning shown when Bun is below the minimum supported version. (#7639)
Performance
- Production backend workers on Linux are now forked from a supervisor that has already imported the app, so they share its memory instead of each importing the app again, which cuts memory use and startup time. Set
REFLEX_BACKEND_START_METHOD=spawnfor apps that are not fork-safe. (#7079) - The
reflex runbackend reload worker is now forked from the supervisor on Linux instead of started through a forkserver, so framework code is shared copy-on-write and the extra forkserver processes are gone. SetREFLEX_BACKEND_START_METHOD=spawnorREFLEX_STRICT_HOT_RELOAD=1for apps that are not fork-safe. (#7113) - Speed up deployment archive creation by reducing filesystem checks for excluded files and avoiding recompression of precompressed frontend assets. (#7450)
reflex-release@0.2.1
Miscellaneous
- Allow towncrier 26. (#7645)
reflex-hosting-cli@0.2.1
Bug Fixes
- The
reflex cloud project listtable shows the project tier name instead of the full tier object. Use--jsonto get the full tier. (#7340) - Print
reflex cloud apps logslines as readabletimestamp [LEVEL] messagetext instead of Python dicts.--jsonstill prints the structured records, and--loglevelno longer hides the log lines. (#7390) - Show
reflex loginguidance when initial authentication rejects an access token, including instructions to replace or remove an explicitREFLEX_ACCESS_TOKENor--tokenoverride.
Whenreflex cloud whoamior a noninteractive cloud command cannot validate a token due to a temporary service or connection failure, suggest retrying instead of replacing credentials. (#7434) reflex deploynow waits and retries confirmed scaling conflicts with progress messages, reusing the uploaded build and preserving support for custom backend URL prefixes. It stops on unrelated failures and uncertain writes, and warns when bounds may remain changed after a failed deployment, including server errors and unreadable success responses. (#7463)- Authentication validation now reports the HTTP status when the control plane refuses the request, and only suggests trying again later for failures that may succeed on retry (timeouts, HTTP 429 and server errors). (#7546)
Performance
- Speed up non-interactive deploys by skipping the provider availability request used only for the interactive provider prompt. (#7452)
reflex-components-radix@0.10.1
Features
checkbox_groupandcheckbox_cardsnow support a controlledvaluewithon_value_change, and the native form props thatradio_groupandradio_cardsalready have. (#7345)- Expose
FormDataon the form namespace asrx.form.FormData. Therx.formstub now declares the namespace as a class, sorx.form.FormData[str, str]works in type annotations; calls such asrx.form(...)andrx.form.root(...)type the same as before. (#7386)
Bug Fixes
- Avoid Emotion's unsafe
:first-childSSR warning for Radix Accordion items in development mode. (#7098) rx.input'sauto_completenow takes the HTML autocomplete value, such as"off"or"email", which used to raise aTypeError. A bool still works and now becomes"on"or"off"; before, React dropped it and browser autocomplete stayed on. (#7418)- Forward progress values to the Radix Root so its state and ARIA attributes reflect the displayed progress. (#7431)
- Remove the
as_childprop fromrx.radio_cards.rootandrx.radio_cards.item. Radix Themes does not acceptasChildon either component: on the root it crashed the page or dropped the grid container, and on the item it did nothing. (#7555)
Miscellaneous
- Update the Radix primitives to the versions bundled with the current
radix-uirelease that Radix Themes depends on (accordion 1.3.1, dialog 1.3.1, form 0.3.0, progress 1.2.1, slider 1.6.1), so apps load a single copy of each primitive. (#7645)
reflex-components-moment@0.10.1
Bug Fixes
- Expose the
utc,calendar,from_,to,ago,element,fallback,filters, andrenderersoptions ofreact-moment2.x, which previously rendered as CSS, and addmoment_providerfor shared defaults and pooled timers. (#7591)
reflex-components-lucide@1.1.1
Bug Fixes
- Preserve imports required by icon props and expose the correct Lucide module through
import_var. (#7604)
reflex-components-dataeditor@0.10.1
Bug Fixes
rx.data_editorcolumns backed by state now get the same defaults as literal columns:typedefaults to"str",idto the lowercasedtitle, and a column may be given as just its title string. The column dicts passed tocolumnsare no longer modified in place. (#7607)
Performance
- Faster redraws for
rx.data_editorgrids whosecolumnsordatacome from state. (#7607)
reflex-components-core@0.10.1
Deprecations
- Submitting a form control's value under its
idis deprecated and will be removed in 0.11; form data will then hold only what each control submits under itsname. Compiling a form whoseon_submithandler takes the form data now warns about each value-bearing control that has a staticidbut noname; give it aname, e.g.rx.input(id="email")becomesrx.input(id="email", name="email"). A control whoseiddiffers from itsnamealso stops adding a field keyed by itsid, and a checkbox or switch whoseidequals itsnamesubmits"on"or nothing instead ofTrueorFalse; read it as aboolfield of aTypedDictto keep a bool. See the form docs for details. (#7386)
Bug Fixes
- Forms now see the
nameof a controlled input (one withvalueandon_change), so aTypedDictsubmit handler requiring that field no longer fails to compile. (#7386) - The default connection toast shows a hydration size error at once and keeps it open until the user closes it. (#7551)
window_event_listenerandclipboardhooks now render in declaration order with the rest of the component's hooks instead of being moved after them. (#7586)