1
0
Эх сурвалжийг харах

raise error on private events (#5152)

Khaleel Al-Adhami 3 долоо хоног өмнө
parent
commit
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: