Release Notes
Decentralized Event Handlers
You can define some events outside of the state they belong to. This requires using the @event
decorator and typing the first (state) argument with the state it belongs to. It gets used by its name as opposed to State.
format.
import reflex as rx
class State(rx.State):
field: int = 23
@rx.event
def update_field(state: State, new_value: int):
state.field = new_value
def index() -> rx.Component:
return rx.vstack(
State.field,
rx.button(
"Update Field",
on_click=update_field(321),
),
)
app = rx.App()
app.add_page(index)
- decentralized event handlers by @adhami3310 in #5227
Escape hatch: change react version
In case react version upgrade broke your packages somehow, you can use the REACT_VERSION
environment flag to change it. We don't support this flag indefinitely though, and it's very much not safe to set.
- add escape hatch for react version by @adhami3310 in #5225
Decimal support in Vars
You can now use decimal in state, but it converts it to a float when sending it to JS. Devin has contributed some of this PR before needing to intervene a bit.
- Add decimal.Decimal support to serializers and NumberVar by @devin-ai-integration in #5226
Style for dragging over upload component
on_drop
for Upload should now support the list syntax. Also adds a style to the default component when a file is being dragged over it.
[Regression Fix] Lifespan tasks
If you were using lifespan tasks along api
or api_transformer
, it might not have been running as expected. It should be fixed now.
This also fixes hot reload on Windows.
Bugfixes
- do not add requirementstxt if pyproject exists by @adhami3310 in #5185
- do not wrap dict in mutable proxy by @adhami3310 in #5193
- validate classname by @adhami3310 in #5204
- get back python-dotenv errors for environment env file by @adhami3310 in #5203
- fix ai template by @adhami3310 in #5202
- slicing a list is not a mutable proxy directly by @adhami3310 in #5221
- [ENG-5696] unwrap Var-typed annotations in @rx.memo signature by @masenf in #5223
- remove height and with from rx video by @adhami3310 in #5210
Chores
- 0710dev by @adhami3310 in #5195
- add python version for development by @adhami3310 in #5186
- use as posix by @adhami3310 in #5192
- bump deps after 079 by @adhami3310 in #5205
- remove frontend arg from needs_reinit by @adhami3310 in #5214
- move proxy classes into proxy.py by @adhami3310 in #5224
- remove simple page from codspeed by @adhami3310 in #5228
- lock uv update by @adhami3310 in #5238
New Contributors
- @devin-ai-integration made their first contribution in #5226
Full Changelog: v0.7.9...v0.7.10