Refreshing a repeating group has been covered so many times over the past few years… One area that I’ve recently had major issues with is refreshing a repeating group from API data. The data would always be the same - Only a hard page reload would give me fresh data.
My case: My app grabs tasks directly from our Wrike Ticketing System that are a particular status via the API. It does this in real-time, with no Bubble Database needed. When my app loads, it goes and grabs all of the current tasks with status “Escalate” in Wrike and slaps it in a Repeating Group. Standard stuff.
Now, since I’m not using a Bubble Database and only grabbing “real-time” data from Wrike, if a status changed in Wrike, my Bubble app wouldn’t know… Unless the user did a hard page reload. Not ideal.
I went through the full gambit of “refreshing a repeating group”… I tried placing the repeating group in a group, resetting the group above the repeating group, blah blah blah, on and on it went with trying all of the different solutions in the forum. Nothing worked.
The solution: As in the post above, I restructured the data to come from a Custom State vs. a Data Source on my Repeating Group. Then, when I wanted to refresh the data, I cleared the Custom State, then replaced the Data in the Custom State… A bit confusing. Here are some pictures:
First, I placed my Wrike API data into a Custom State on Page Load.
Note: When this data is pulled from Wrike on page load, it is cached, meaning it does not refresh unless there is a fresh page reload - A way Bubble can speed things up by reducing the amount of data traffic. So, I had to find a way to “bust the cache” as @mishav mentioned in the post above.
For testing purposes, in my app, I created a manual REFRESH button. When clicked, I wanted it to grab fresh Wrike data without having to do a page reload. This would then pick up the fact that if a task no longer existed in Wrike, it would be removed from my app immediately!
To do this, I plopped down a Refresh button, and then the following workflows on said button:
First workflow step on Refresh button: CLEAR the Custom State that used to have my Wrike API data in it.
Second workflow step: Exact same as the page load. See screenshots below.
By “clearing” the custom state before setting my Custom State again, it was finally able to refresh the data without requiring a page reload. I can go to Wrike, change the status of my task, click “Refresh” in my Bubble app, and it works!
Hopefully this helps anyone.