🐞 fix: use return value of event handler to decide if dispatching sho…
…uld stop
if there's multiple controls in the view, when it's triggered, some textbox may contain value will be treated as True, thus trigger event handler accordingly. These value may not be changed at the moment, thus event handler should just ignore it by return False, however, routing.py currently lack the mech to leverage the return value, and search next event handler.
please refer to https://github.com/h2oai/wave/discussions/1404 for more details
I also find the current behavior a bit inconvenient, because of the Trigger=True side effects (see also: https://github.com/h2oai/wave/discussions/952).
This PR here by @zillionare looks similar to one of my workarounds, but I have propagation as opt-in rather than opt-out:
async def _match_predicate(predicate: Callable, func: Callable, arity: int, q: Q, arg: any) -> bool:
if predicate:
if predicate(arg):
res = await _invoke_handler(func, arity, q, arg, **params)
return True and res is not False
else:
if arg:
res = await _invoke_handler(func, arity, q, arg, **params)
return True and res is not False
return False
Wouldn't that be okay @lo5? That doesn't change behavior of any current code, but would open a litte backdoor to allow invokation of more than one @on-matched handler.