Skip to content

Commit 351ac2a

Browse files
authored
raise error on private events (#5152)
1 parent 2be3a88 commit 351ac2a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

reflex/event.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,6 +2064,8 @@ def wrapper(
20642064
"Background task must be async function or generator."
20652065
)
20662066
setattr(func, BACKGROUND_TASK_MARKER, True)
2067+
if getattr(func, "__name__", "").startswith("_"):
2068+
raise ValueError("Event handlers cannot be private.")
20672069
return func # pyright: ignore [reportReturnType]
20682070

20692071
if func is not None:

0 commit comments

Comments
 (0)