Handle props annotated as list/dict of EventHandler (#4257)
These props are NOT event triggers themselves, but rather they are props that expect a list or dict of event handlers. Additional fix for calling an `@rx.event` decorated event handler with no arguments.
This commit is contained in:
parent
41b1958626
commit
8f07082eba
@ -645,7 +645,7 @@ class Component(BaseComponent, ABC):
|
|||||||
# Look for component specific triggers,
|
# Look for component specific triggers,
|
||||||
# e.g. variable declared as EventHandler types.
|
# e.g. variable declared as EventHandler types.
|
||||||
for field in self.get_fields().values():
|
for field in self.get_fields().values():
|
||||||
if types._issubclass(field.type_, EventHandler):
|
if types._issubclass(field.outer_type_, EventHandler):
|
||||||
args_spec = None
|
args_spec = None
|
||||||
annotation = field.annotation
|
annotation = field.annotation
|
||||||
if (metadata := getattr(annotation, "__metadata__", None)) is not None:
|
if (metadata := getattr(annotation, "__metadata__", None)) is not None:
|
||||||
|
@ -1489,6 +1489,11 @@ if sys.version_info >= (3, 10):
|
|||||||
"""
|
"""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __call__(
|
||||||
|
self: EventCallback[Q, T],
|
||||||
|
) -> EventCallback[Q, T]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __call__(
|
def __call__(
|
||||||
self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
|
self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
|
||||||
|
Loading…
Reference in New Issue
Block a user