Hi Antti. Any tip in how to achieve writing a new document inside a FB Collection taking the given userId key(UID). I’m trying to do this giving the path of the collection as you can see in the attached image. Considering that I am already getting the UID using the the data Slot UserID this would be possible, right? However nothing happens, when I save a new document, It behaves like there’s no /Users/$slot(‘ds_SlotuserID’) declare. Thank you. Best, Marcos
Guys. Still lost and walking in circles. What I am looking for is writing the document key with the same key given by UID of Firebase, to be able to associate it to Users collection where you already find a column with the same userID keys for each user. Data recorded when users finalize their registration (after authenticating with google) given them more information such as Address, Places, etc
Possible using React Studio Right? I suspect it is. If done, I can say that my project is not far from going to deploy. Thank you again
I’m not 100% sure but I think this happens because Studio does not know if you’re adding or editing existing or adding a new document. Unfortunately when you want to edit document you need to go to Edit screen through a list.
If you’re trying to create document with certain document name then unfortunately I think it is not possible at the moment. Currently document key is always automatically generated UUID.
Hi Annti. Thanks for your time. See, I’m already saving and editing a document just fine. Here’s how it works:
When you sign in using Google, automatically you have the userID, userName, userPhoto and userEmail. Great, For my app, I just need to confirm the last information which is the user current home address, including city and neighborhood. From a list of communities, first, you choose or search for your neighborhood and then you will be taken to another screen where you provide your addresses. Clicking “Finish” creates the user in the “Users” collection containing the necessary data that allows associating the user with the neighborhood key. Both collections bring the same ID. Thank you for your help. Best, Marcos
Ok then this looks quite simple and saving user information is already working on your end?
Yes, that’s right. Well, sounds great Antti. Let try this.
Hi Antti, I tried in many ways, but it didn’t work. I checked the link, but it was not clear to me how to do this. Any clues on how to make this script simple? Thanks a lot. Best
I tested this a bit and it’s not that simple to save the value from Data sheet to Data slot. This would need to be added into Screen state script and is so hacky that I don’t want to share it
I’d suggest you to edit the Firebase Login plugin so that it would load the users data from Firestore and then would save it to Data slot. I’d probably add this code into “saveCurrentUserDataInApp” function which get’s executed after the successful login.
P.S. This is my hacky solution which I added to screen’s State script. Note that you need to have at least two states and data slot selected from State setting to get the script written into exported code.
var user=this.props.appActions.getDataSheet(‘users’).items; //Get users data sheet
//If user is not undefined
var userFavCity=user[‘favoriteCityId’]; //get the favoriteCityId columns value into variable
this.props.appActions.dataSlots[‘ds_SlotFavoriteCityID’]=userFavCity; // save the value to data slot
Hey Antti. Thank you. Glad you share this. I’ve worked according to your hacky solution and the plugin as well but apparently something still missing. Best, Marcos
In the script you’re setting the data slot value to string ‘userNeighbourHoodsID’. I’m guessing you should have userNeighbourHoodsID variable there instead of the string. Just remove the ‘’ from the code. Anyway you need to debug the code from sources tab from developer tools to find out what is causing the problems.