Breaking Changes
- Background tasks now receive the state itself instead of a
StateProxy. A state is writable while the running event holds its lock; outside of that, like in a background task, writes raiseImmutableStateErroruntil the state is entered withasync with self.StateProxy,ReadOnlyStateProxyandImmutableMutableProxyare removed fromreflex.istate.proxy, andrx.get_statereturns the state, writable insideasync withit. (#7313) - Two state mixins that do not inherit from one another can no longer both declare a var of the same name: creating the state that combines them raises
MixinVarNameConflictErrorinstead of silently giving the two mixins one var. Declare the var on the state that combines them, which both mixins then use, rename it in one of the mixins, or declare it in a mixin both inherit from. A mixin may still declare without a default (count: int) a var that the parent state or another mixin declares, to type it for its own code. (#7381) - Form
on_submitnow buildsform_dataonly from each control'sname, as deprecated in 0.10.1: a control'sidno longer adds a field. Give every submitted control aname, e.g.rx.input(id="email", name="email").reflexnow requiresreflex-components-core0.12.0 or newer, which builds form data this way. (#7540) - An event trigger made of one event handler now returns a result stream that settles when the handler finishes, instead of a promise that resolved once the event was sent. A component that awaits the value its callback returns now waits for the handler, and sees a rejection if the handler raises. Calls that
.throttle(),.debounce()or.temporaldrop or delay now return a stream too, where they returnedundefined: a debounced call gets the stream of the dispatch its window ends with, a throttled-out call the stream of the last dispatch while it is open, and any other skipped call a stream that is already complete. (#7761) - The compiled value of a computed var that reads another computed var declared with
initial_value, shown until the page connects, is now derived from that initial value, so the reading getter must accept it. A getter that callsself.name.upper()on@rx.var(initial_value=None) def name(self) -> strnow fails to compile: give the initial value the getter's type, such asinitial_value="", or handleNonein the reading getter. See Initial Values. (#7905) - Reflex now uses
httpx2for HTTP requests and verifies HTTPS certificates against the operating system's certificate store. Applications that importhttpxmust declare it as their own dependency or migrate tohttpx2; see HTTP clients and certificates. (#7970) - The backend reads the client token only from the Socket.IO CONNECT auth payload, so it no longer appears in the socket URL, where proxies, access logs and security scanners picked it up. A custom Socket.IO client sends it as
auth={"token": client_token}, together with its session cookie: one that sends the token only as?token=in the URL gets a new token and fresh state on every connect. See the browser sessions guide. (#8089)
Deprecations
@rx.dynamicis deprecated and will be removed in 1.0. (#8079)
Features
-
Add the
state_explicit_event_handlersconfig option. When enabled, only methods decorated with@rx.eventbecome event handlers; other public state methods stay plain Python methods. (#7033) -
reflex runreads the session signing keys fromREFLEX_SECRET_KEY. Without it,reflex rungenerates a temporary key for that run. A configured key shorter than 32 bytes stops the run at startup. (#7361) -
Add browser sessions using HttpOnly cookies and a
POST /_reflex/sessionendpoint that issues a client token bound to the requesting session. Sessions scope HTTP and custom WebSocket state access; authenticated sockets can renew their cookie credentials without losing client state. See the browser sessions guide for configuration and migration. (#7362) -
An event handler's non-event
yieldandreturnvalues now reach the frontend code that dispatched the event:addEvents(...)returns a result stream to iterate withfor awaitorawaitfor the last value, and it rejects when the handler raises. A trigger made of one event handler returns the stream too, so it can be passed to a React prop expecting an async callback (likeloadOptions). Yielding a non-event value no longer raisesTypeError; events are still chained rather than sent, and events mixed with other values or an unawaited coroutine still raise it. See Yielding Values to the Frontend.@rx.event def load_rows(self, page: int) -> list[dict]: return db.rows(page)
const rows = await addEvents([ReflexEvent("state.load_rows", { page })]);
(#7761)
-
A background event handler can now
awaitrx.call_script,rx.call_functionandrx.run_scriptoutsideasync with selfto get the script's result directly, instead of passing acallback:@rx.event(background=True) async def measure(self): size = await rx.call_script("({w: window.innerWidth, h: window.innerHeight})") async with self: self.width = size["w"]
A script error raises
BrowserScriptError, a missing resultTimeoutError(browser_call_timeoutinrxconfig.py, ortimeout=per call), and a tab that is closed, reloaded or away longer thanbrowser_call_grace_periodraisesBrowserDisconnectedError. Awaiting insideasync with selfraisesEventHandlerTypeError. See Awaiting Results. (#7955) -
Add
rx.plugins.UploadPlugin, which serves the upload endpoint,/_upload. Apps that configure neitherpluginsnordisable_pluginsfor it serve the endpoint when they use uploads, as before. An app that only sendsrx.upload_filesfrom a component of its own adds it topluginsto have the endpoint served. Add it todisable_pluginsto never serve the endpoint, in which caserx.uploadandrx.get_upload_urlraise aConfigError. See UploadPlugin. (#8090)
Bug Fixes
- Events from a client linked to an
rx.SharedStateno longer re-send the unchanged router data with every state update. (#6841) - Creating an
rx.Appno longer re-executesrxconfig.py, so classes defined there keep their State registration and Python class identity. It also no longer re-reads the environment, so aREFLEX_*variable that the app module sets (for example withload_dotenv()) no longer reaches the config underreflex run; load such files withenv_fileinrxconfig.pyinstead. (#7144) - Remove deleted app assets from subsequent frontend builds and exports while preserving plugin-generated public files. (#7233)
- A state var declared with
dataclasses.field(...)now raises aStateValueErrorwhen the class is defined, naming the var and pointing torx.field(...), instead of the app failing to compile withTypeError: cannot pickle 'mappingproxy' object. (#7308) - AppHarness now points the development frontend at
localhostfor the backend API, so browser cookies remain same-site during tests. (#7364) - A var that a state mixin declares without a default, like
count: int, no longer replaces the var of that name declared by a parent state of the class the mixin is combined into. The mixin uses the parent's var, as re-annotating it on the substate does. Re-annotating such a var with another type, likecount: str, now gives it that type's default instead of the original type's. (#7381) - State vars changed with an in-place operator (
+=,*=,|=,&=,-=,^=) now mark the field dirty, so the update reaches the frontend. This covers mutating a local alias of a state var, likeitems = self.items; items += ["b"], which previously changed the backend value without sending it. The same operators on a state proxy outside a mutable async context now raiseImmutableStateErrorinstead of silently mutating the state. (#7713) - Custom frontend and backend exception handlers now resolve their annotations in the handler's own module, so annotating
exceptionwith an application-defined exception class no longer crashes app startup withNameError. Handlers wrapped with afunctools.wrapsdecorator are now accepted too. (#7714) reflex runno longer fails to start whenREFLEX_HOT_RELOAD_EXCLUDE_PATHSlists a path that does not exist. (#7743)- Preserve state changes made by event handlers that raise or are cancelled when using the disk state manager (the default), matching the in-memory and Redis managers. (#7769)
- Fixed a hang with
rx.SharedState: an event cancelled or failing while taking the locks of its linked states no longer leaves the locks it already took held. With the in-memory state manager this blocked every client linked to that token until restart; the disk and Redis managers freed the lock only later, through garbage collection or lock expiry. (#7776) reflex run,reflex exportandreflex compileno longer skip the frontend compile, and serve or export the previous pages, after a dev run that was stopped before its backend worker loaded the app. (#7829)- Backend-only starts without a frontend build now register the same bundled libraries a frontend compile would, including implicitly enabled Radix Themes, so reflex-enterprise apps no longer fail with
Library @radix-ui/themes is not bundled. The derived libraries are saved to.web/backend/bundled_libraries.json, so later starts skip that work. (#7849) - The deprecation warning for decorators placed above
@rx.eventnow names every affected method of a state, instead of only the first one in each class. (#7867) router.session.client_ipnow normalizes theX-Forwarded-Forentry selected bytrusted_proxy_hopsto an IP address, dropping any port and IPv6 brackets and unmapping IPv4-mapped IPv6 addresses, and falls back to the connection's peer address when the entry is not a valid address. (#7880)- The rejected event websocket origin warning now names the trusted
X-Forwarded-Protoand, when only the scheme differs, says the page was loaded over http while the trusted proxy reports https instead of blaming Host forwarding. (#7892) - Fix
reflex runfailing to start the frontend on Windows installs that have bun but no Node.js (restartWithMergedOptions() was called, but the process has already been restarted). (#7895) - Lifecycle events and
add_hooksof a component underrx.cond,rx.matchorrx.foreachin an@rx.memofunction now run with their branch and once per loop item, as on a page, instead of when the memo mounts. A component that spreads the memo'srx.RestPropor wraps itschildrenkeeps the old behavior. (#7903) - A computed var, sync or async, that reads another computed var declared with
initial_valuenow sees that initial value while the initial state is compiled, instead of running the other var's getter, soreflex exportandreflex runno longer fail when that getter needs a database or a request. (#7905) app.add_page(...)now raisesBackendVarFormatErrorwhenon_loadis a backend var such asState._handler, instead of accepting it. (#7908)- The compile progress bar no longer ends one step past its total, as in
16/15. (#7912) - Modifying a state with
app.modify_stateno longer logs an "Attempting to send delta to disconnected client" warning when no client is connected with the token, such as the shared token of a shared state. The clients linked to a shared state still get the update. (#7921) - With redis, a state update sent from another app instance right after a client's first connection to an instance is no longer lost. (#7938)
reflex deploynow shows its progress and success messages after the export step, not only warnings and errors. (#7947)reflex db makemigrationsno longer crashes with aCompileErrorwhen an added column defaults to an Enum member or a JSON list or dict. An Enum default becomes the server default; existing rows get NULL in a nullable JSON column, with a warning, and a NOT NULL one is refused until it has aserver_default. (#7958)- An explicit
--loglevel infois no longer ignored when INFO is already the current level. Like any other--loglevelvalue, it now reachesREFLEX_LOGLEVELand overrides aloglevelset inrxconfig.py. (#7960) - Shared assets (
rx.asset(..., shared=True)) are now copied straight into the app's build when a symlink cannot be created, such as on Windows without Developer Mode, instead of stopping the app from starting. (#7962) - A background event handler that overrides one from a mixin or a parent state can call it with
await super().handler()again, instead of raisingImmutableStateError. (#7964) reflex renamenow updates imports of the app module, such asfrom myapp.myapp import appandfrom .myapp import State, and a customapp_module_importinrxconfig.py. Before, the renamed app failed withModuleNotFoundError. (#7969)- A page added without
image=no longer gets anog:imagemeta tag pointing at the relativefavicon.ico, which link previews could not resolve. Pass an absolute URL asimage=to set a page's preview image. (#8006) reflex initno longer deletes or replaces files already in the directory. A template's files are added only where nothing has their name, and init warns about each file it kept, such as apyproject.tomlorREADME.mdfrom a remote template. When a file or folder named after the app already exists, init stops with an error before it writes anything. (#8025)reflex run,exportandcompilereinitialize an existing.webdirectory when the frontend template changed without a version bump, e.g. in an editable install, instead of building with stale or missing template files. (#8028)- Raise the minimum
python-engineioto 4.13.2 (CVE-2026-48802, CVE-2026-48809: denial of service) andpython-socketioto 5.16.2 (CVE-2025-61765: pickle deserialization in some multi-server deployments; CVE-2026-48804: denial of service), so an install that resolves the lowest allowed versions no longer picks up a vulnerable release. (#8038) reflex export --zip-dest-dirno longer packs the zips it writes intobackend.zipwhen the directory is inside the app. Exporting there a second time madebackend.ziparchive itself and grow until the disk was full. A destination directory that does not exist yet is now created instead of crashing the export, and--exclude-from-backendnow also applies to files under.web/backend. (#8042)- A stylesheet given to
rx.App(stylesheets=...)as anrx.asseturl is found again: the?v=version queryrx.assetappends and a configuredfrontend_pathprefix are not part of the file's path, and a shared asset that could not be symlinked is read from its source. (#8048) rx.asset(shared=True)now links an asset whose path has directories, such asrx.asset("icons/logo.svg", shared=True), instead of failing because the directory below the external assets folder did not exist. (#8048)- With
REFLEX_OPLOCK_ENABLED, Redis state managers no longer keep a lock in memory for every token after its local state lease ends. (#8054) - Reflex applies its own CORS middleware once per request, so a backend response no longer repeats
OrigininVaryfor each Reflex CORS layer. Reflex no longer adds CORS middleware to the Starlette or FastAPI app passed asapi_transformer. CORS middleware that your own transformer adds still runs in addition to the Reflex layer. (#8060) - An app that stops using uploads now stops serving
/_uploadafter its next compile. If your app sendsrx.upload_filesfrom a component of its own, withoutrx.upload, addrx.plugins.UploadPlugin()topluginsto keep the endpoint. See UploadPlugin. (#8090)
Performance
- Reduce the per-var overhead of building the state updates sent to the client after each event. (#6162)
- Avoid rescanning unexpired disk state files on every idle write-queue tick. (#7060)
- Production backend workers now freeze the Python heap once the app is built, so full garbage collections skip the app's long-lived objects. This covers workers that build the app themselves (spawned granian workers, uvicorn and gunicorn), which previously walked the whole app on every full collection. (#7945)
rx.asset(shared=True)finds its calling module withoutinspect.stack(), which read the source of every frame on the stack on each call. (#8048)
Documentation
- Add an Upgrading to Reflex 0.11 guide covering the changes most likely to break an existing app, with the fix for each. (#7865)
Miscellaneous
reflex.istate.proxy,reflex.istate.deltaandreflex.istate.manager.tokennow re-export their modules fromreflex_base.state, where the core ofrx.Statelives. (#7314)- Reflex applies its own npm overrides only when
overridesinpackage.jsonis a JSON object; any other value is left in place with a warning for you to fix. (#8086)