-
-
Notifications
You must be signed in to change notification settings - Fork 328
Proposal: support partial functions as EventHandlerFunction #1333
-
Currently it's not possible to use a partial function as EventHandlerFunction. I could use a lambda for synchronous event handlers, but it won’t work for async event handlers.
Pseudo code of what I'm doing:
@component def ListSelector(items): async def handle_select_list(item_id): await do_something(item_id) return [ html.div( { "key": item["id"], "class": "list-select-option", "onclick": partial(handle_select_list, item["id"]), } ) for item in items ]
I'm aware that I could refactor this code in a way that I don't need to use a partial or a lambda, but anyways, I thought it'd be better if it is supported.
It just need a couple of lines to support partial functions: masipcat@837a18c
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
Archmonger
Feb 7, 2026
Issue #1334 created. Feel free to PR this feature.
Replies: 1 comment
-
Issue #1334 created. Feel free to PR this feature.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Answer selected by
Archmonger
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment