Weird behavior in “Resource Query” when using the table.newRows property

Hello !

I am new to the retool world.

I have implemented a resource query called “createFoo”, which uses an api rest to create new registers. The body (and in the url) is using the “newRows” property of the “table” component:

{
“name": {{ table1.newRows[0].name }},
“active": {{ table1.newRows[0].active }}
}

This “createFoo” resource is behaving oddly because it is not yet configured for use anywhere in the application, but “createFoo” is being invoked automatically by Retool when a change is detected in any cell in any row of the table “table1”.

I think this behavior could be a bug, any idea how to fix not launching “createFoo” automatically when columns are being edited?

Thanks in advance

3 Likes

Hi @davidr and welcome to the forum!

So, what I'm guessing it's happening is

  1. your API query run behaviour is set to Automatic

  2. as such, every change in your table, is refreshing the hole table1 component in someway, and triggering your query.

You may want to change the run behaviour to Manual and see if that stops running the query.

If not, can yo uconfirm if yo uhave any other event triggers in your table, and send a screenshto if possible?

Also, you can check the console on the bottom right, and you should see info of what is triggering your query.

Hi @MiguelOrtiz !

Yes, I can confirm that the Run Behaviour is set to "Manual", but also take into account that no new row it is being created, so supposedly it shouldn't be launched even having a dependent variable. I am quite sure that in the application there is no invocation to "createFoo".

But... we just realized that if we use the "? "operator in newRows[0] the query is no longer launched automatically, so the problem is solved.

Thanks

2 Likes