React-redux-firebase: feat(profile): populating of profile from Firestore

Created on 4 Dec 2018  路  12Comments  路  Source: prescottprue/react-redux-firebase

What is the current behavior?
Populate feature doesn't work properly when trying to populate a firebase.profile from a firestore collection.

image
image

What is the expected behavior?
The field "role" under firebase.profile should be filled with the content from the "roles" collection. For instance, if a user has a role "admin", which is the key in my "roles" collection, it should populate the field with that content but instead I still get the "admin" string.

enhancement

Most helpful comment

Yeah, you are doing everything right. That warning is letting you know that this feature doesn't exist yet for Firestore 馃槃. Good to hear there is interest in the feature though. I'll update when I have a better sense of when I can get to adding it.

All 12 comments

@raygadas Did you include profileParamsToPopulate? For real time database populate works with the profile by automatically attaching listeners when passed profileParamsToPopulate as outline in the populate docs (since the main profile listener is already automatically managed). That said, I am not sure of whether I got the chance to add that for firestore profiles.

@prescottprue I tried including it before but it gave me a warning on the console so I deleted it. I have now added it again, I keep getting the same warning and the profile isn't populated. I think I wrote/did everything properly, but maybe you can point out any mistake.

Here's what I'm doing:
Index.js
image

Dashboard.js
image
image

Firestore
image
image

Console (with warning)
image

Yeah, you are doing everything right. That warning is letting you know that this feature doesn't exist yet for Firestore 馃槃. Good to hear there is interest in the feature though. I'll update when I have a better sense of when I can get to adding it.

Sure, thank you. Any ideas of a how I could do it in the meantime?

You can query directly for the role by passing it as a prop and creating a query (either manually or through firestoreConnect). Then populate should have what it needs to create a populated profile.

I'll try to get to an example of what I mean some time this week, but adding support for the feature should be coming soon too.

Sound good, I'll give it a try and will wait for your example too. Thanks for the help!

@raygadas @prescottprue can you tell me where I can find an example of how to do that? it would be very helpful!

@xdarkleonx this issue is about populating the profile section of Firestore, which as mentioned, is not yet supported. It looks like in your stack overflow post though that you are trying to just populate an item in a list loaded from Real Time Database, not something on the users profile or from Firestore.

ok, my mistake

@prescottprue Any thoughts on this feature being implemented. Your library is really nice!

@prescottprue Any thoughts on this feature being implemented. Your library is really nice!

Desperate for this feature too!

Would also love to see an example of a workaround for this for the time being!

Was this page helpful?
0 / 5 - 0 ratings