Set resource value to true instead of resource.trigger()

I’m rethinking my current setup since I got feedback that the updating of the data on screen is slow.

Right now I have a resource getItems (retool db) as the source of a collection view. When the item button is clicked, it runs code and queries. I then trigger getItems again to update the collection. But it’s not snappy. It would be snappier if I just set the item “done” value to true and display text in that collection card that it has been “done/checked”.

I tried to do this by doing something like getItems.data.done[24]=true;

Or self.selectedItem.done=true;. But the collection card doesn’t change. The value under “queries and transformers” doesn’t get changed also. I have to trigger getItems and load everything before it shows the value “done”.

What’s the correct way to do this?

You have to use a temporary state if you want to be able to modify data like that.

You can create a new temporary state value in the left panel:

Then I would add a success handler to your SQL query to update your temporary state value whenever the SQL query runs.

You'll need to update all your components to reference the temporary state instead of the query data.

1 Like