by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Random Precision Ltd
    @precisioncoding_twitter
    @prescottprue I've just tried your recommendation to @claudiarslima to put the redux state after the firestoreConnectas I'm working towards the same solution; however, that throws an error TypeError: Cannot read property 'state' of undefined? @claudiarslima did you work out a solution on your own?
    Jon R. Humphrey
    @jonrandahl
    apologies @prescottprue & @claudiarslima I accidentally composed that message from my other account: @precisioncoding_twitter! #doh! Could any replies be made to me on this account? Very much obliged and happy new year to all!
    Jon R. Humphrey
    @jonrandahl
    I think I sorted this out @prescottprue, it seems to be working well, I wonder if anyone can point out any downfalls?
      componentDidUpdate(prevProps) {
        // Typical usage (don't forget to compare props):
        if (this.props.charityId !== prevProps.charityId) {
          this.setState({ charityId: this.props.profile.primaryCharity.id });
        }
      }
    
    ...
    
    const mapStateToProps =  (state) => {
      // console.info('analytics state', state);
      return {
        uid: state.firebase.auth.uid,
        profile: state.firebase.profile,
        charityId: state.firebase.profile.isLoaded ? state.firebase.profile.primaryCharity.id : "0",
        transactions: state.firestore.ordered.transactions || null,
      }
    }
    
    export default compose(
      connect(mapStateToProps),
      firestoreConnect((props) => [
        {
          collection: 'transactions',
          where: [
            // [ 'agent.id', '==', props.uid ] //<- this works but is the wrong filter
            [ 'charity.fb_page_id', '==', props.charityId ] //<- right filter, falls over as id doesn't exist yet
          ]
        }
      ]),
    )(Analytics);
    Aviyam Ivgi
    @aviyam1811_gitlab
    Hey,
    There are any news about the progress on supporting reference data type in listeners? (ISSUE-#60)... I waiting for this so much and I cant find any elegant workaround to fix this by using only react-firestore?
    SagarSidabs
    @SagarSidabs
    Hey guys, I am trying to get multiple subcollections from a collection using firestore connect. I get the data correctly in firestore.collectionName.data but i get only the last subcollection data in the firestore.collectionName.ordered. Is there a way to use aliases instead of overwriting the variable names in ordered.
    firestoreConnect(props => [
        { collection: "matches", doc: props.match.params.matchId },
        {
          collection: "matches",
          doc: props.match.params.matchId,
          subcollections: [{ collection: "firstInningsBatting" }]
        },
        {
          collection: "matches",
          doc: props.match.params.matchId,
          subcollections: [{ collection: "secondInningsBatting" }]
        },
        {
          collection: "matches",
          doc: props.match.params.matchId,
          subcollections: [{ collection: "firstInningsScore" }]
        },
        {
          collection: "matches",
          doc: props.match.params.matchId,
          subcollections: [{ collection: "secondInningsScore" }]
        }
      ])
    Scott Prue
    @prescottprue
    @SagarSidabs you can use storeAs to alias results
    SagarSidabs
    @SagarSidabs
    oh cool, so the syntax will be , storeAs : secondInningsScore after each subcollections key
    Thanks scott, thanks for this wonderful package
    Scott Prue
    @prescottprue
    @SagarSidabs Yup! Glad you like it :) The newer version (available through alpha tag on npm) stores sub-collections differently by default in hopes of combating a number of issues (some similar to what you are describing) - so that might also be worth a try
    Jon Haro
    @eleventhaus
    @prescottprue I'm trying to connect firestore to redux-form. Firestore doesn't receive data/ordered until LISTENER_RESPONSE is called but by then I already have gotten an error that variable is undefined. I'm following the docs and using the compose/connect method for class components:
    firestoreConnect(props => [{ collection: `petParents/${props.profile.ppid}/pets`, storeAs: "pets" }]),
    connect(state => ({
        pets: state.firestore.ordered.pets
      })),
      connect((state, props) => ({
        initialValues: {
          contactInfo: {...state.firebase.profile.contactInfo},
          vetInfo: {...state.firebase.profile.vetInfo},
          emergencyContacts: [...state.firebase.profile.emergencyContacts]
        }
      }))
    That data gets to props eventually once LISTENER_RESPOSNE is called by firestore but not before i get an undefined error. What am i doing wrong?
    Scott Prue
    @prescottprue
    @eleventhaus You will need to wait for data to load before using it, especially when initializing a form like that (otherwise the form well need to be reinitialized once the data comes in, which will require an option passed to redux-form). Also note that in that same part of the docs there are examples for how to do the same with HOCs using recompose.
    Jon Haro
    @eleventhaus
    TY!
    Scott Prue
    @prescottprue
    @eleventhaus Also, unreleated, but in the example you posted spreading objects into props like that could cause some rendering performance issues down the line (since re-renders happen every time props change, which will be happening every time). You may want to look in to selectors (a library called reselect helps)
    Jon Haro
    @eleventhaus
    Thanks!
    So I tried using the isLoaded strategy but that only responds to changes in firebase. The data I'm waiting to load is in Firestore. When I check, isLoaded is true before Firestore data is loaded.
    Should I use firestore.status.requesting instead? What's the best way to do that?
    Scott Prue
    @prescottprue
    @eleventhaus That may be a bug. Would you mind opening an issue pointing to your version and how you connect? I would maybe fallback to using data for now since that should work with isLoaded and they get set at the same time
    Jon Haro
    @eleventhaus
    Neither data or ordered on firestore are synced to isLoaded. I believe isLoaded is synced to when the firebase profile loads. I'll open an issue. Thank you for your help!
    Scott Prue
    @prescottprue
    @eleventhaus Well, it isn't really "synced", it actually depends on which prop you are passing to it, but yeah the issue sounds great.
    Richard Scotten
    @rscotten
    @prescottprue I want to build an infinite scroll list using listeners using the orderBy and startAfter options on firestore.setListener(). I've hacked something together using storeAs, but it's not pretty. Is there an example or recommended way to do this?
    Scott Prue
    @prescottprue
    @rscotten you should checkout react-waypoint. Using that to attach queries manually should work
    Richard Scotten
    @rscotten
    @prescottprue thanks!
    Richard Scotten
    @rscotten
    @prescottprue ah, react-waypoint is a cool library but I'm already using react-virtualized. Sorry for being unclear. My issue concerns needing a different storeAs name for every page of listeners because, without it, each listener call overwrites the results from the previous page/listener. So, my workaround is to use storeAs and create a unique store name for each listener. For example, I store the first page in storeAs: 'items.0', 2nd batch in storeAs: 'items.1', 3rd in storeAs: 'items.2', and so on. I'd rather be able to store all listener results in storeAs: 'items', which makes my mapStateToProps simple: items: state.firestore.ordered.items || []. Otherwise I have to reduce all the state.firestore.ordered.items.n stores into items. I'm using reselect to memoize this, but it would be nicer if each page of listeners could just append the new page of items to state.firestore.ordered.items rather than using a different storeAs for each listener. Is that possible using a config option like mergeOrdered, allowMultipleListeners, or oneListenerPerPath?
    Dustin Graves
    @dustingraves
    Hey for the starter expo/react native, is there a quick way to get started with login and auth?
    Richard Scotten
    @rscotten
    Dustin Graves
    @dustingraves
    @rscotten thanks I will take a look
    Serhii Palash
    @serhiipalash

    @prescottprue is there anything like profileParamsToListen in react-redux-firebase?

    I want to add global listener to the app on connections/${profile.connectionId} node in database.

    There is profileParamsToPopulate Api. The thing is that it doesn't listen some prop under profile continually, but only populates it once on every profile update.

    jasonejavier
    @jasonejavier
    Hi good day! I'm having a hard time implementing data filter using firestore. Can someone help me?
    Scott Prue
    @prescottprue
    @serhiipalash there is not the ability to listen for any populates currently, but that is something that has been on the roadmap for a while
    Jascha Brinkmann
    @jaschaio_twitter
    @jasonejavier what exactly do you mean by "data filter"?
    I've found firestores filtering capabilities very limited so depending on your needs it might not even be possible with firestore alone
    Scott Prue
    @prescottprue
    I agree, not sure what is meant by “data filter”. Personally have found firestore’s querying to be enough for most filtering/sorting I have needed, but it does sometimes mean adding new parameters to your objects
    Marcus Lundgren
    @marluo
    Hey
    trying to use store.getState() in firestoreconnect, but can't seem to get it working. using 3.0
    uhm
    work please?
    Marcus Lundgren
    @marluo
    Ugh, anyways props and store seems to be referencing the same object
    store === props is true
    so im not sure what im doing wrong, or what i should do differentley, cant seem to access store. Maybe not available in 3.0?
    Marcus Lundgren
    @marluo
    ignore everything i just said
    Marcus Lundgren
    @marluo
    is there any way to specify the key when storing it in redux?
    image.png
    so i dont have to deal with the weird -LD5..
    Scott Prue
    @prescottprue
    @marluo using storeAs you can do that
    Marcus Lundgren
    @marluo
    Well i tired doing that but only came this far
    image.png
    saved it as lols obviously
    Also - i tried accessing the store in firebaseconnect, but cant seem to do that either. Is this changed in 3.0? same issue as above