github reflex-dev/reflex v0.7.10

latest releases: v0.8.9, v0.8.8, v0.8.7...
4 months ago

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)

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.

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.

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.

  • Upload: drag_active_style and multiple on_drop specs by @masenf in #5207

[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

Chores

New Contributors

Full Changelog: v0.7.9...v0.7.10

Don't miss a new reflex release

NewReleases is sending notifications on new releases.