SolidJSS
SolidJSโ€ข15mo agoโ€ข
2 replies
pedro00dk

Solid/reactivity lint rule complains about async custom event handlers

Hello, I'm having some issues with solid eslint plugin regarding custom event handlers.

const comp = <my-element on-click={async () => {}} />
// warns:
// This tracked scope should not be async. Solid's reactivity only tracks synchronously. (eslintsolid/reactivity)

Just the line above is enough to reproduce it in playground. Is there any way to disable it? Or this could be a bug?
I also checked if this has anything with event delegation as custom events are not delegated and it does not seem so:

const comp = <my-element on-click={async () => {}} on:click={async () => {}} onclick={async () => {}} onClick={async () => {}} />

// produces:
var _tmpl$ = /*#__PURE__*/_$template(`<my-element>`, true, false);
(() => {
  var _el$ = _tmpl$();
  _el$.$$click = async () => {};                   // onclick (WARNS)
  _el$.$$click = async () => {};                   // onClick
  _el$.addEventListener("-click", async () => {}); // on-click (WARNS)
  _el$.addEventListener("click", async () => {});  // on:click
  _el$._$owner = _$getOwner();
  return _el$;
})();
_$delegateEvents(["click"]);
Was this page helpful?