Skip to content

Commit 5d03ea7

Browse files
committed
Support partial as EventHandlerFunction
1 parent b68a38a commit 5d03ea7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/reactpy/core/events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import dis
44
import inspect
55
from collections.abc import Callable, Sequence
6-
from functools import lru_cache
6+
from functools import lru_cache, partial
77
from types import CodeType
88
from typing import Any, Literal, cast, overload
99

@@ -107,6 +107,9 @@ def __init__(
107107
while hasattr(func_to_inspect, "__wrapped__"):
108108
func_to_inspect = func_to_inspect.__wrapped__
109109

110+
if isinstance(func_to_inspect, partial):
111+
func_to_inspect = func_to_inspect.func
112+
110113
found_prevent_default, found_stop_propagation = _inspect_event_handler_code(
111114
func_to_inspect.__code__
112115
)

0 commit comments

Comments
 (0)