My team and I have found a possible bug. Our use case is as follows. We are opening a page with url params. This parameter will then be used to find the row of a specific table, select it and after selecting we run a jsQuery that will validate certain fields of the SelectedRow to then open a modal. The problem/bug at the moment is that after selecting the row, when I try to run the jsQuery and access SelectedRow it tells me that it is null. Has anyone experienced this?
In line 1, is the url variable something you defined? I don't think there is anything built in that would be defined there. If you want to get current search params you could do something with urlparams built in info
const url = new URL(urlparams.href);
const params1 = new URLSearchParams(url.search);
for (const [key, value] of params1) {
console.log({key, value})
}
No, I haven't defined url variable, it's a built in retool variable you can use to access url object. The issue is not getting the data that's coming from the url, but in the selectedRow that even when i select it via selectRow() method it says that is null.
Although that shouldn't be the issue, you should be able to fetch the selectedRow directly without defining a constable..... it is weird you're getting null. What happens when you hover over selectedRow?
There could be a race condition, what if you try to debounce your success event handler in your first query to give time for the table row to be selected properly?
You're right! I've just added debounce on both query's and it's working. But isn't weird that i need to use debounce when I'm running this query's on success event handler?
It is very weird, and I've had many headaches with this (see this post as example)
Strangely, the event handlers and the manual onSuccess/onFailure do not seem to work in the same way.
I've made a habit of testing any succession of queries to make sure that all data is being rendered properly, and if not use debounce or pass the values as additionalScope
They are the same. But I've seen occasions where using a script, e.g.
query1.trigger (onSuccess { query2.trigger() }
where query1 will prepare raw data for an api call which I will reference in query2.
With the above code, query 2 was throwing me errors (and I noticed that the data was not being read correctly from query1), so I decided instead to add an event handler to query1 on success, to trigger query2. This, although the same thing, worked.