Removing clones after leaving page

I did search for the answer before posting but nothing seemed to exactly reference my question. I have created an app which is now available on UK App store - Throttle Therapy.

However, I am having issues with clones when users use the bottom nav bar. What should happen is that users select a region they want to see search results from. A list is then populated based on their decision and a button is cloned up to 20 times depending on how many options there are in the region they have selected. When they leave the screen and come back to it the app is supposed to remove the clones and empty the list so they can start again. However, what is happening is that these clones are still there when user comes back to the screen so that when they look for more results they still have the clones from the last search. The search still works as it loads them after these clones that have not disappeared but they stay there no matter what region they now select.

I have been adding the clones into an invisible list and telling the app to remove the clones in this list on screen start up. I even tried removing the clones on screen close but this didn’t work either. I also tried putting them into their own lists for each page instead of one list for all pages. But this didn’t fix the problem either. The only other option I can think to try is creating 20 seperate buttons and populating with information from the list respective of the index. But this seems like a long way round and I think I might be just missing something. Any thoughts?

Can you make a simple project that demonstrates this issue? Without seeing your code, it’s hard to know why this is happening. Cloned components should not exist unless they are created when a screen opens.

Hi @tatiang

Sure here is a screenshot of the screen opening:

Users click a button which then loads a helper function after this code you see here:

The helper function where the clones are made I have split into 2 screenshots to get close enough:


Does this help at all?

You might be able to see I have even tried removing the clones on screen close but this isn’t working either. However, I am now unsure whether this is due to the fact that my test platforms and blocks don’t seem to be syncing which I have raised another topic for.

I think I have resolved the issue. But I also think it is an issue of my own creation. When the clones are made I save them to an app variable list. I tell the app when loading a new screen to remove this app variable but it is only trying to remove them from the current page. I am then telling the app to make this list empty so when the screen loads again the clones are still because the app is trying to remove all clones in the app variable which no longer contains these clones. I think I need to keep this list because of other functions which rely on it but I have made a workaround by making lists for each individual page rather than relying on one list for all clones in the app. I think this has fixed the issue. It did on thunkable live test app so I have published the changes to the store in the hopes that this resolves.

1 Like