Glad to see you have come into the light (Firebase) and rejected the darkness (data sources).
The way Thunkable and Firebase interact on lists is the problem. Firebase assigns number to each item in the list. From my limited reading, lists (aka Arrays) are sequence dependent. This seems like the rationale for Firebase assigning numbers.
(apparently) Thunkable assumes that the array/list in Firebase will be a zero based listed with no gaps. If there are gaps, Thunakble fails. You can test this out by trying to retrieve your “data” list in a few scenarios. Using the Realtime database website UI.
- base case (works correctly in thunkable)
- Delete the last entry (works correctly in thunkable)
- Delete any other entry (thunkable fails)
- Add back the deleted number with some goofy value (works correctly in thunkable)
SOLUTION
Finally, getting back to to your problem, here are the solutions I have used, depending on the situation:
- If the sequence is IMPORTANT (e.g. logs, chat threads, etc), load the list from firebase into thunkable. Delete the items using the thunkable list blocks, then save the entire list back to firebase
- If the sequence is UNIMPORTANT (e.g. members of a group, shopping cart items, etc.) use JSON Properties instead of a list. To make sure the name of the property is unique, i use the the Firebase UserID (returned from the sign in block) and the Seconds Since 1970 block (with the decimal removed)
In the example below “Conversations” would normally be a list, but since the order doesn’t matter, there are just a bunch of properties.
To loop through the elements in the “list” you can use something like this
Notice that the list contains the Property NAME, not the actual value. It took me a while to get used to this, but now it is second nature.
Happy Thunking!