Click handlers being evaluated "early"

I have been tracking down "warning" messages like this:

image

and have traced at least two to what appears to be evaluation of click handlers when there is no click. Here is an example:

n_IRI can't be read because there is no selectedRow. Why? Because there was no click. But why is this code running?

image

The system seems to be evaluating click handlers when a table "loads" or, otherwise, in absence of the event which is the necessary precondition for the click handler. Thus triggering spurious warnings.

Hi @Roland_Alden

Thanks for reaching out!

I think you can add a ? using this syntax, as long as your table only allows for one row to be selected at a time. Can you let me know if that helps resolve the error?

It does not seem to break anything but it does not make the error go away either.

With ?

and before:

Here's some additional info on this. The underlying problem is that the component portfolio.value is empty when the app starts and a query runs with that empty string as a parameter. This is what comes back from the query:

The state of this option:

Does not seem to matter. The errors show up in the IDE anyway.

Unsurprisingly this "fixes" the problem. Rewriting the underlying query from:

select ([share-guid]) from [skill-editor-shares] where [portfolio-guid] = {{portfolio.value}}

To this monstrosity:

select ([share-guid]) from [skill-editor-shares] where [portfolio-guid] = {{portfolio.value.length == 0 ? '00000000-0000-0000-0000-000000000000':portfolio.value}} order by ts DESC

Does make the error go away. But it's not a pretty solution.

1 Like

Thanks for sharing the current solution! I think we can do more here to help with these errors, but at least they shouldn't impact the end user experience