فهرست منبع

raise error on private events (#5152)

Khaleel Al-Adhami 1 ماه پیش
والد
کامیت
351ac2ac58
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      reflex/event.py

+ 2 - 0
reflex/event.py

@@ -2064,6 +2064,8 @@ class EventNamespace:
                         "Background task must be async function or generator."
                     )
                 setattr(func, BACKGROUND_TASK_MARKER, True)
+            if getattr(func, "__name__", "").startswith("_"):
+                raise ValueError("Event handlers cannot be private.")
             return func  # pyright: ignore [reportReturnType]
 
         if func is not None: