Any tips for making my function more reliable

Hi
I have a function in my app that works as expected 95% of the times, but 5% the function acts weird. Can anyone give me some advice what I could do to make it more reliable and hit 100%?

The function is a swipe left, and it will pass the user to a new screen where you can edit an item in a list, which will then pass you back to the “main” screen again.
The list is a local data list viewer but it also store the list in Airtable. So the update first goes for the local list, then the same update runs for the Airtable as well.

This is how the code is setup:

Variable:
Screenshot 2021-04-24 at 21.54.42

The swipe function:

The “update”-function on the “editScreen”:

Mostly it works great (I can live with the delay for the update, I guess that’s caused by Airtable and Thunkable comunication?)

I’ll add some links with video-clips showing how it mostly works and should be working and also the issues that sometimes appears.

  1. This is how it mostly appears and which is fine for me:
    Dropbox - myApp-Ok behaviour.mov - Simplify your life

  2. Sometimes when I delete some rows before editing any row, some or all of the deleted files shows up again. (this is happening very rarely ) I guess it has something to do with the Airtable is not updated?
    Dropbox - myApp-Issue 1.mov - Simplify your life

  3. Sometimes it just doesn’t happen anything so I need to re-do it and it works.
    Dropbox - myApp-Issue 2.mov - Simplify your life

This Is my startup block for screen1 which is the screen that the function is taking me to after updated the item. In that block I will get all the data from Airtable, filter it two view only the current users items, and then add those items to the dataListViewer which is the one that I see in the app.

Please advise me if you got any ideas when seeing this. I have been thinking about adding a pause before getting the airtable-rows in start-block for screen1, just to give it a chance to update in Airtable first, but then again I do not want to slow down the appearance in the app…
How would you have done?

Thanks!

1 Like

You need to read more about how to better use asynchronous function. Most of database functions work in asynchronous mode which means the block next to it will run and not wait the database action to finish and therefore you are experiencing such situations.

Thanks. That feels exactly like what I am missing.
Do you have any tips where I can learn about that?

I will google around and see if I find anything.

Thanks.

1 Like

Is this what you mean?

1 Like

Yes, although the post was talking about Firebase RTDB but the asynchronous info is general to all Data Sources.