# Firebase - Values updated automatically reverted

**URL:** <https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802>\
**Category:** Questions about Thunkable X\
**Tags:** firebase\
**Created:** [May 4, 2019, 1:17pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802 "2019-05-04T13:17:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![IWendling](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/iwendling/32/31718_2.png) [@IWendling](https://community.thunkable.com/u/IWendling)\
**Post date:** [May 4, 2019, 1:17pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/1 "2019-05-04T13:17:56Z")

</div>

Ah ha, here I come back again. I have been trying to deal with constant app crashes and now, to my surprise, a serious problem with Firebase.

I made a button to mass update some values on a Firebase database. I click the button and rush to Firebase screen, where I can see every data being update, one by one. Just like a dream… But it becomes a nightmare when after some time, I look again at all my data and I realize that all the update I made has been REVERTED as if I had never done anything.

Has anyone experienced this?

Well, my data base is both readable and writable…

---

<div class="post-metadata">

**Author:** ![Avram](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/avram/32/13989_2.png) [@Avram](https://community.thunkable.com/u/Avram)\
**Post date:** [May 4, 2019, 1:22pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/2 "2019-05-04T13:22:16Z")

</div>

How did you insert the original data? Show your blocks.

If you’re inserting it on the app startup then every app startup will set original data.

---

<div class="post-metadata">

**Author:** ![IWendling](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/iwendling/32/31718_2.png) [@IWendling](https://community.thunkable.com/u/IWendling)\
**Post date:** [May 4, 2019, 1:27pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/3 "2019-05-04T13:27:19Z")

</div>

Ooops, it’s quite a big one…

The original data was updated to Firebase from a JSON list (made in Excel). The only thing I change in the list is the field BOX. To do so, I have this code below:

 ![1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b8c7e1d8877cdca971d18f902f384ab83b1b58fd.jpeg)

---

<div class="post-metadata">

**Author:** ![IWendling](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/iwendling/32/31718_2.png) [@IWendling](https://community.thunkable.com/u/IWendling)\
**Post date:** [May 4, 2019, 1:33pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/4 "2019-05-04T13:33:50Z")

</div>

Everytime I update this field, I check FIREBASE and everything is perfect. After some time I look back and this action has been reverted… Today it happened 3 times to me.

Could it be a problem with cache or some kind of memory?!  
The code is really working, the problem is that it undo later. I have to other task to mass call the database.

Here you can see it working:

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 4, 2019, 2:41pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/5 "2019-05-04T14:41:07Z")

</div>

Hello,

I think the problem is not in FireBase, but in the algorithm. From your blocks, I see that you are in a loop trying to work with asynchronous get and set methods using the synchronous approach and delay. Such an algorithm is an excellent source of permanent errors.

What problem do you need to solve?

Do you see the “error” block in the Get and Save methods? This block is used to track errors, but your code ignores the occurrence of errors and continues to call these methods in a loop.

Do you understand how the work of asynchronous blocks differs from synchronous?

---

<div class="post-metadata">

**Author:** ![IWendling](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/iwendling/32/31718_2.png) [@IWendling](https://community.thunkable.com/u/IWendling)\
**Post date:** [May 4, 2019, 3:47pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/6 "2019-05-04T15:47:40Z")

</div>

Yes, in fact I have to put some delay, otherwise it skips the whole task without acomplishing anything.

My code ignore errors! 🤣 I really don’t know how to use this error block. What would you advise me to treat this error? Do you have any example for me to take a look?

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 4, 2019, 6:48pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/7 "2019-05-04T18:48:41Z")

</div>

Unfortunately, I do not have a ready-made example yet, but Mark showed an example of working with an asynchronous block.

> [@Asynchronous Blocks within Loops](http://community.thunkable.com/t/asynchronous-blocks-within-loops/33524):
>
> We recently had a bug reported by a user who was seeing strange behaviors within the “then do” part of a RealtimeDB.Save block which was within a loop block. The strange part was that even though each execution of the RealtimeDB.Save block was called with the current value of the loop variable (or something based on the current value) the blocks within the “then do” part always just saw the last value of the loop variable! This is a well known issue when using asynchronous function blocks (lik…

I do not know your final task, but I would consider the option when we first prepare all the data to write to FireBase, and then save it with just one call to the Save method.

---

<div class="post-metadata">

**Author:** ![IWendling](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/iwendling/32/31718_2.png) [@IWendling](https://community.thunkable.com/u/IWendling)\
**Post date:** [May 4, 2019, 7:06pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/8 "2019-05-04T19:06:48Z")

</div>

Wow, thank you so much for this link you sent me. It really clarified my mind. I had no clue of the problem and as I am not a programmer or anything related to IT, I don’t know how to debug. This is the 4th “bug”/“limitation” I come across here on Thunkable.  
It would be really good if these limitations were directly updated in the manual. I was almost giving up of my project…  
Thank you once again. 🥰

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [May 6, 2019, 5:55pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/9 "2019-05-06T17:55:59Z")

</div>

Thanks, @IWendling! We have some plans to make our asynchronous blocks easier to use, so that they work better within loops.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:13pm UTC](https://community.thunkable.com/t/firebase-values-updated-automatically-reverted/75802/10 "2024-11-08T12:13:50Z")

</div>


