htmx
htmx copied to clipboard
`hx-vals="js: { a: event.target.value }"` errs
Here's an example of the issue https://codepen.io/reedspool-gh/pen/XWYbRXo
For some reason, if clicking multiple times quickly, hx-vals="js:{ test: event.target.value }"> causes an error, TypeError: Cannot read properties of undefined (reading 'target') at htmx.org:1:29917. I narrowed this down to the execution of Function(...)() in getValuesForElement.
If you click the button slowly, the count will appear and then increase. But if you click it twice quickly, an error appears and the HTMX no longer triggers upon clicking this button ever again.
I think this is two problems:
- If there is an htmx error, I think that should never stop the htmx event from triggering on the same element again
- The specific error that appears must be a bug, right?
I narrowed the bug down to the second click having an event value of undefined instead of an actual event as expected.
I'm having a similar issue, except in my case event is always undefined.
the delay causing the event to be undefined definitely caught me off-guard and had to spend some time debugging
@reedspool did u manage to work around it?