Clarity, please: When exactly does a repeated item refresh/reload/re-render?

Hi,

I’m experiencing a lot of frustration because I just moved some logic loops over to Global Canvas (in anticipation of the Breaking Changes noted in Harri’s post about the new runtime), and now everything seems to be behaving differently than I would expect (in a bad way).

Previous setup:

  • Loop in root logic of default page frequently (several times per second) fetches a collection of records & sets a corresponding data variable (list)
  • On each page, a container item with an image inside is repeated with this data variable

Previous behavior:

  • Containers/images refresh only when something about the repeated data variable changes. So, if one of the records in the database is updated, all of the images will appear to flicker briefly; otherwise, the images will appear steady (not refreshing/reloading/re-rendering). This is good.

New setup:

  • Loop in Global Canvas frequently (several times per second) fetches a collection of records & sets a corresponding app variable (with correct schema).
  • On each page, a container item with an image inside is repeated with this app variable (list)

New behavior:

  • The containers that repeat with the app variable are now constantly refreshing/reloading/re-rendering. This means that all of the images appear to flicker constantly, whether or not any updates have been made to the database. This is much worse (and also completely demolishing my CPU).

So my question has a few parts:

  1. Can someone please articulate rules for how we should expect repeated items like this to behave, and specifically, when we should expect them to refresh/reload/re-render?
  2. In this specific case, is the change in behavior due to my switch from a Data Variable to an App Variable as the “Repeat With” list for these containers with the images in them? Or is it due to my switch to the Global Canvas as my location for the logic loop?
  3. Is there any way to make a Data Variable set from the Global Canvas accessible globally? (My understanding is no, and that Data Variables are specific to their page contexts. Just wanted to double check, though!)
  4. Is there any way to work this so that this logic loop, which I want to be running no matter what page the user is on, can be run on the Global Canvas, without creating this “constantly refreshing” effect? Or do I just have to create a copy of the loop in each page if I want to avoid the flickering?

Thanks,
~Ethan

Okay I did a deep dive into this and ran some experiments… here are my results. Whether a loop is on Global Canvas or the page root doesn’t seem to matter; rather, it’s about what type of variable is serving as the source of the content. I would love confirmation/correction on this.

I can’t see why content repeatedly re-rendering when set by an (unchanged) app variable would be a desirable feature in any use case, but given that behavior, the workaround seems to be that you can set a Data Variable from the App Variable and use that as an intermediary, setting your “Repeat With” from the Data Variable instead to avoid constant re-rendering.

Were you testing with the 1.9 runtime or the (now released from beta) 2.x? The way repeats are handled is different in v2 runtime and should not refresh the whole list, but I can get some better answers from the client team – definitely would be good to write some docs around the refresh logic!

I, too, am running into issues here and would like to understand this better.
Watched a great series of videos by Steve Stava on YouTube, here’s the scenario (high level):
Multi-page app, one page is a GET COLLECTION, a repeating list of each item.
Another page is a GET ITEM with one 1 item from the list on it - added logic to update the data variables, that works, I can even post those data variables to a database via my REST Data integration - all good there. BUT, when I exit this page and return to my previous GET COLLECTION list of items, they are not updating.
But in Steve’s YouTube lessons, they do, nearest I can figure, he is on runtime 2.4.35 (videos made late '20/early '21), whereas I’m now on 2.6.5 (this is May '21 for me at this time of writing).
What is the suggested way to refresh a repeating list of items when they have been updated?

The solution I’ve implemented is that on the event, Page Focused, of my list of items page, I do a Get Collection and then assigned that to a Data Variable and it will update when the page is focused. The issue is a delay introduced when the page loads, as the List of repeated items gets the data, then, because the page has focus, my added logic is executed, doing the query twice at start.