New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(query): support for populate on queries #48

Closed
muhammadsayuti opened this Issue Jan 6, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@muhammadsayuti

muhammadsayuti commented Jan 6, 2018

Do you have any thought about making populate feature for this like in react-redux-firebase ?

While subcollection is good but based on the documentation said:
Limitations: You can't easily delete subcollections, or perform compound queries across subcollections.

Well if you want me to help i have some sample to make this work that i take from your pupulate.js file in react-redux-firebase with some additional features like:

  • nested object populate
  • populate as different child name using as property in populate object
  • populate object inside array

Just let me know if you're interested.

@prescottprue

This comment has been minimized.

Owner

prescottprue commented Jan 6, 2018

@muhammadsayuti Definitely interested, and there have been a few people already looking for this feature. Here is the issue on react-redux-firebase where the feature was requested.

This will most likely require changes in both redux-firestore and react-redux-firebase.

Feel free to post what you have or reach out over gitter.

@prescottprue prescottprue changed the title from Any thought about making populate feature ? to feat(query): support for populate on queries Jan 6, 2018

@marcorm

This comment has been minimized.

marcorm commented Jun 30, 2018

This would be really useful!!

@Ajlanclos

This comment has been minimized.

Ajlanclos commented Aug 31, 2018

What is the status on this? Also, is it possible to get root collection that are references? If it is, can someone link me an example?

Thanks!

@prescottprue

This comment has been minimized.

Owner

prescottprue commented Nov 2, 2018

Got a basic version of this working by copying the logic over from react-redux-firebase. Going to try to get it released some time over the next week.

@prescottprue prescottprue referenced this issue Nov 5, 2018

Merged

v0.6.0-alpha.3 #147

3 of 3 tasks complete

prescottprue added a commit that referenced this issue Nov 8, 2018

v0.6.0-alpha.3
* fix(reducers): correctly update state for docs with keys that contain a dot when using storeAs - @compojoom
* feat(query): consolidate oneListenerPerPath and allowMultipleListeners logic - @alexmattson
* feat(query): initial support for populate - #48, [RRF 362](prescottprue/react-redux-firebase#362)
@prescottprue

This comment has been minimized.

Owner

prescottprue commented Nov 8, 2018

Included in v0.6.0-alpha.3 release 🍾

Here are the docs: https://github.com/prescottprue/redux-firestore/tree/next#population. It is basically a direct port over from react-redux-firebase, and you actually still import populate (used to construct prop from state data loaded from populates) from react-redux-firebase.

Going to close this for now since it is in pre-release, but I'll still update this thread when releasing it to latest. Everyone should feel free to reach out (either here or over gitter) if anything isn't working as expected or just to say "It works!".

@MattJakeman

This comment has been minimized.

MattJakeman commented Nov 9, 2018

Thanks for the update!
I have used it briefly and get the correct data when dumping out to the console. However, when I inspect the redux store it doesn't seem to be storing the populated data. Is this the expected behaviour? EG:

console

redux

You can see in the top image that the 'createdBy' field has pulled in the expected user data, but the second image shows the state of the redux store which just has the user ID. I may well be misunderstanding something here but I would have expected redux to have the 'createdBy' user data in as well.

@prescottprue

This comment has been minimized.

Owner

prescottprue commented Nov 9, 2018

@MattJakeman That is the intention with populate. Many users want to be able to still access the separate un populated data (makes sense since it was queried), so the data is loaded into state just like with normal listeners (dispatch of LISTENER_RESPONSE). Then you use the populate utility to build your populated object from the different pieces of state. The settings you pass to it are the same as what you passed to populates in the query config.

There is more about why and the examples in the populate section of the docs as well as under the populate part of the recipes section.

@MattJakeman

This comment has been minimized.

MattJakeman commented Nov 9, 2018

@prescottprue thanks for the explanation. For some reason I'd got it into my head that redux should be filled with the same data. It's easily workable in that state for me but thought I'd flag it up just in case it was a bug.

Thanks for the speedy response on it and keep up the good work :)

prescottprue added a commit that referenced this issue Nov 10, 2018

@prescottprue prescottprue referenced this issue Nov 10, 2018

Open

v1.0.0-alpha.2 #149

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment