Replies: 1 comment 2 replies
-
The state tracking doesn't seem to pick up state in event handlers 😢 This app is considered stateless import reflex as rx
class State(rx.State):
def do_download(self):
filename = "foo.txt"
(rx.get_upload_dir() / filename).write_text("test")
return rx.download(rx.get_upload_url(filename))
@rx.page()
def index():
return rx.button("Download", on_click=State.do_download)
app = rx.App() |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Try out the Prerelease
Please report any problems you encounter in this discussion thread or as separate issues on reflex-dev/reflex.
pip install 'reflex~=0.4.4a'
Schedule
2024-03-07 21:12 PST: 0.4.4a1 is released for general testing
2024-03-08 18:30 PST: 0.4.4a2 is released, which fixes state detection for event handlers and on_load
2024-03-11 15:53 PDT: General release of 0.4.4
Breaking Changes
Component._get_vars
signature changeUnlikely to affect most users; however the signature of
Component._get_vars
has changed to accept a newinclude_children
parameter which should either be handled internally or passed tosuper()._get_vars
if this function has been overridden in a custom component.New signature
New Features
Expose
lang
and other attributes on<html>
tagrx.upload
exposeson_drop
event triggerTrigger upload immediately after files are selected by passing an
rx.upload_files
-wrapped handler directly toon_drop
trigger.on_drop
event trigger for rx.upload component. by @masenf in Exposeon_drop
event trigger for rx.upload component. #2766rx.el.form
supportson_submit
event triggerImprovements
Dependency Changes
Enable
/_upload
whenget_upload_url
is usedPreviously, the
rx.upload
component was the only thing that resulted in the endpoint being enabled.Update
docker-example
for more realistic deploymentsa simple dual port
Dockerfile
compose.yaml
providing a separate backend container and static frontend served with automatic TLScompose.prod.yaml
including postgres database and redis containersapp.Dockerfile
for single container, single port deployment on a platform service like Render, Railway, and Google Cloud Rundocker-example overhaul by @masenf in docker-example overhaul #2690
Include app.Dockerfile for deploying to container hosting platform by @masenf in Include app.Dockerfile for deploying to container hosting platform #2784
Improve "Stateless" app detection
Apps which import State, but do not actually use it are considered stateless.
Apps that use
rx.State.router
automatically work without defining a dummy substate.Apps dynamically create state at runtime (#1877) correctly include used dynamic substates.
Better support for plain SQLAlchemy
reflex component
CLI improvementsBuild and publish in a single step
Improved custom component template
More comprehensive
.gitignore
fix template for custom comp by @Lendemor in fix template for custom comp #2787
[REF-2141] Custom component command improvements by @martinxu9 in [REF-2141] Custom component command improvements #2807
EventChain
list syntax is undeprecatedIt is now acceptable to pass a list of multiple
EventHandler
to an event trigger, such ason_click
.Bug Fixes
/_upload
404 and missingon_load
handlers in production deploymentappearance="dark"
andtheme_panel=True
Other Changes
New Contributors
Full Changelog: v0.4.3...reflex-0.4.4
Beta Was this translation helpful? Give feedback.
All reactions