After the recent master commit 7a81413ef8d8c41d09352424461a277a18f65c6e, that was a fix for https://github.com/custom-components/pyscript/issues/512, kwargs of state_trigger are empty if state_hold argument is used. ``` @state_trigger(f"{constants.TEST_BOOLEAN}", kwargs=dict(my_kwarg=123)) def tryouts1(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs): log.debug(kwargs) ``` This will output `{'my_kwarg': 123}` ``` @state_trigger(f"{constants.TEST_BOOLEAN}", kwargs=dict(my_kwarg=123), state_hold=1) def tryouts2(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs): log.debug(kwargs) ``` This will output `{}` Rolling back to version 1.5.0 fixes the issue.
Activity
copy func_args so that kwargs don't persist across
redo fix for #512; see #516
craigbarratt commentedon Aug 17, 2023
Ah - good catch. I pushed a new fix for #512 which hopefully doesn't break the hold kwargs. Still need to do more testing.
ALERTua commentedon Aug 18, 2023
The fix seems to work. I've deployed basic scratch kwargs tests on my instance to detect such issues early on in the future.
added tests for issues #512 and #516