Skip to content
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

Feature request: Maps of references #1

Open
loicnico96 opened this issue Sep 25, 2018 · 1 comment
Open

Feature request: Maps of references #1

loicnico96 opened this issue Sep 25, 2018 · 1 comment

Comments

@loicnico96
Copy link
Contributor

loicnico96 commented Sep 25, 2018

Example usage:

Let's say I have a (dynamic) list of several user IDs that I can give to my components. My components needs additional information that are contained in sub-collections of these users. In this case, I cannot use the current Array functionality because I will not be able to tell which sub-document corresponds to each user (I cannot use the document ID because it will be the ID within the sub-collection, not the ID of the parent user).

export default connectFirestore(
  (db, props) => ({
    subRefs: props.users.reduce((refs, user) =>
      Object.assign(refs, {
        [user.id]: getSubCollectionRef(db, user.id, props.something)
      }), {}),
  }),
  MyComponent,
)
@Olovorr
Copy link
Contributor

Olovorr commented Oct 17, 2018

I will have a look at this by the end of this month, but feel free to create PR if you'd like 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants