Skip to content

Commit cdfa8b5

Browse files
authored
make on load lambda work (#5856)
* make on load lambda work * ok ?
1 parent cb0ddfa commit cdfa8b5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

reflex/event.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,9 @@ def fix_events(
18661866
# Fix the events created by the handler.
18671867
out = []
18681868
for e in events:
1869+
if callable(e) and getattr(e, "__name__", "") == "<lambda>":
1870+
# A lambda was returned, assume the user wants to call it with no args.
1871+
e = e()
18691872
if isinstance(e, Event):
18701873
# If the event is already an event, append it to the list.
18711874
out.append(e)

0 commit comments

Comments
 (0)