Issue refreshing a list/grid from a collection in Firestore

I actually tested that with your project and the latest code before sending the build and it worked to me with desktop and mobile. Can you test it again?

I am currently testing it. I just updated the project to this new version and deployed it to my Firebase hosting. In mobile version the button works just fine, but in desktop mode it refreshes the list like before. You can take a look in the screen “Arreglos” in the deployed version of the project that I just exported with the latest build that you left here.

1 Like

Have you checked how it works on your localhost? Maybe the update to Firebase hosting has not got the latest code? Also check that the button really has the right interaction. When I test this with your project file on my computer it works with all browsers.

I will try later checking twice everything and let you know. Thanks!

Ok. You were right! I guess I made some mistake because I have both stable and beta version in the same PC and I probably mixed things. I tried to clean everything and install just this last version and now it is working. Thank you so much!

1 Like

Hey @Antti_Neonto. I believe I realized something important! You may remember that I have had issues refreshing lists because of elements that wouldn’t disappear or mixed when changing the dataSheet source of it. It became worst in at some point and that’s why I began this thread which led you to discover about the duplicated keys value and the one of the last updates approaches it and solved it.

I still have some issues only in certain lists and I went to check if it would be because of duplicated key values and it is! But the issue only appears in horizontal lists. Is it possible that you solved the problem in vertical lists but it is still there in horizontal lists? Because I just solved a problem with a document refusing to go by deleting the key value in the Firestore database.

If you solve this problem I wouldn’t worry about key values but I wonder how can I avoid RS to save a key value because it does it automatically even though I don’t have that value in the save data interaction. The duplicate keys comes because I have several collections and also duplicated documents because of the noSQL logic.

Thank you!

Just an update to this issue. These last updates seem to have fixed part of the problem. Now it seems to behave properly with a list with editable text elements and that is great! But I still have some issues mixing certain elements. From the last experiences, I am almost sure that the issues is related with the “key” field in Firestore. When the user creates a new document through the webapp, even though I don’t have the field “key” specified in the “Save” action, it is automatically created. As I have documents from different collections in the main screen, sometimes there are duplicated keys in these collection and that creates some issues when deleting or refreshing because some elements refuse to go away even though they are not anymore in the database.

I wonder if would be possible to solve this in some way or if there is workaorund I can implement to avoid writing this “key” field in my documents.

Thank you very much!

Writing the Key field into Firebase Database among Save data interaction should be fixed in the latest releases however it will not solve the problem if Firestore Database already has some documents with the “Key” field.

That’s great news! No problem about that. I cleaned my database not so long ago of all key fields and I ran into the issue after some weeks that new documents have been written. I just have to clean those few documents and it would be fine from now on. Thank you!

I might be missing something. I updated React Studio to the latest version, changed a few things that I wanted to improve and reviewed the save interaction where I was having issues before. I saw no “key” field anywhere -as there wasn’t before- so I just assumed that the only difference woud be that it wouldn’t automatically save that key value anymore. But it still does. I have a “heart” icon to save certain documents into the users favorite collection. The save interaction will create a duplicate document of the main with carried properties. It is like this in my project:

It is not possible to show all the fields that are being saved with the interaction but “key” and “document_path” are not there and it still creates them automatically. Those “key” values are creating that mixed documents issue everytime. I have to keep cleaning all the time. What can I do?

In the screenshot you have document_key set to be saved. That something you should definitely fix first.

I have it like that because I need to have a specific document_key instead of the automatic Firestore random name that is give. Why is that bad?

Ok then it will probably create a field named document_key. I’m not 100% about this but that’s probably what will happen in the code.

No. That is the way I have to manually name my documents and it works just fine. Saving that field creates the document with the established name in that column. It does not create any additional field. Do you think that has something to do with the “key” field that is automatically created?

Ok then it seems to work as you wanted. About the Key field you should probably just check the code or debug with browser’s developer tools if the ”key” field is really added into the document when saving data.

I just checked and this is the result. In this first screenshot you can see the original document in Firestore:
Captura de pantalla 2021-05-05 a las 9.22.27

However, when I click the heart icon to save a copy in the users collection, the console shows this:

Captura de pantalla 2021-05-05 a las 9.22.58

There are two additional fields that I haven’t specified anywhere: “document_path” and “key”. I have no problem about additional information being added, but the “key” field gives some issues because of duplicated “key” values in different collection, which I believe will be something common in a NoSQL database.

Am I doing something wrong?

I think you have a old version of the Firebase plugin. The latest version is 29 but version 28 should also work. Just go to the Plugin store and install the Firebase plugin from there.

This is interesting. I just updated the plugin, restarted RS, emptied the browser cache and so on and it seems to be working fine. When I click the same icon, it does save the document without those added fields. I checked what was happening in the developer console and those key values appear there even though they are not in Firestore :upside_down_face:
Captura de pantalla 2021-05-05 a las 10.24.04
That is the console log and this is the duplicated document in Firestore, which is just fine:
Captura de pantalla 2021-05-05 a las 10.23.36

In the plugin code the unwanted fields are removed after writing the console log. That’s why they appear in the log. See the screenshot and the highlighted line which removes the three unwanted properties from object.

Ok. Now it makes sense. I have been testing the newly exported project and all of the issues are gone! This is a huge update for me. I have been dealing with the refreshing issue since the beginning, trying workarounds and now it is finally solved! Thank you so much!

1 Like