Bubble seems to cache external API calls from my RG

Hi,

I am playing around with APIs and RG. For illustration I’ve set a basic example, I have 1 text element inside a RG. The text displays the return from an API call. The API returns 1 text.

The thing is, when I display the page, Bubble seems to cache the response because every row displays the same answer.

My API connector is set like so:

What I was expecting was to do an API call on each single row of the RG and so I should see several different texts on my page.

Why does it behave like that?

Thanks

Have you checked whether the response is list of different texts?

Can you share API response raw body and RG settings with the text fields setting?

He’s put text in each RG cell, and the content is Get data from external API.

Bubble sees you’re making an API call. It sees there’s no input parameters, so assumes the output would always be the same. Hence, it only makes the call once. Why would it run it multiple times when it knows what the output is?

However, you’re clearly working with a random response API, which is unusual. To display the random responses in a RG, you need to get a list of facts from the API, probably from a different endpoint. Your use case probably isn’t possible (straightforwardly) simply because it’s inefficient design to make an API call for each cell, when you can make one API call for multiple cells.

1 Like

Interesting to witness directly one of the performances optimizations Bubble does!

Bubble stays vague about what optimizations it does exactly, have you learned that somewhere or did you get to that conclusion based on deduction and experience?

The API used is for training purposes hence the random response with no parameters.

Thanks

@georgecollier is totally true and yes this done to optimize performance. A single tips is to add a header (name it like you want) and use Current cell’s index into this header. This will force Bubble to call the API for each cell.

1 Like

Yes, that works, thanks :slight_smile: