JavaScript query stops being runnable

I have a JavaScript query which is triggered when a row in a table (L) is selected. This row determines inputs into the query and it populates another table (R). As you click on rows in the left table the right table keeps refreshing by rerunning the query.

After the browser has been running a while and I have turned away from it and come back I notice two behaviors which are new (as of the last week or so).

  • The application will have gone through a [Reset app state], possibly more than once. This is bad :slight_smile: .
  • The query does not run and thus table (R) does not populate.
    If I open up the query in the IDE and manually try to run it, it does not run. I can click test or run but the query Output pane displays nothing. Not even a spinner.

The "only logical" thing that would block the query from running is that it has the Disable query property populated with{{document.visibilityState != "visible"}}. However, this expression is false, so it is not a good reason for the query to not run.

But, there is one trick that will work. If I edit the query in a meaningless way (insert or delete a space inside a comment and do Save) then it will start working. It will work for minutes or hours until it breaks again; which it eventually will.

This is all new behavior since last Wednesday night (Nov 19).

1 Like

It sounds like the app is losing state after being idle, and the query engine gets stuck. The query not showing a spinner means it is not firing at all, even though the disable rule is false.

This is likely a recent platform issue. Resetting the state and β€œsaving” the query to make it run again suggests something is breaking in the background after the page sleeps.

For now, the best workaround is to re-save the query or reload the app. You may want to report this to support, since it started after the recent update.

Instead of disabling the query based on document.visibilityState, use a variable to track visibility and check it at runtime inside the JavaScript query, or wrap the trigger in a visibility guard. This avoids the query getting stuck disabled when the tab becomes visible again.

Pattern:

  • Variable: isTabVisible = document.visibilityState === "visible"

  • JavaScript query:

if (isTabVisible.value) {
  // Fetch and populate right table data here
}

  • Or wrap event trigger:
if (document.visibilityState === 'visible') {
  populateRightTableQuery.trigger();
}

Table Problem .mp4 this is video

So the above trick did not work. But what did work was fixing the expression:

What I probably had was {{ document.visibilityState === "visible" }}

I frequently make this mistake :roll_eyes:

PREMATURE VICTORY

A few minutes later it stopped working again. This "Disable query" setting probably has nothing to do with the underlying problem. What does work reliably is making a meaningless edit to the query and clicking Save.