Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Јане Џумеркоски
    @janedzumerko
    :wave: all,
    Recently I started using "react-redux-firebase".
    I have list of items (each item has subcollection) and on user selection I take one item and store the data for its sub-collection as storeAs: 'activeItemSubcollection'
    But later if I go back and choose another item, I already have some data in activeItemSubcollection, and for less then e second (while new item data is fetched) I see the old item data. Does someone knows how can I clean 'activeItemSubcollection' while moving from one component to another (also I am changing routes, if this helps)
    benomatis
    @benomatis
    how do I clear firestore (!) requesting and requested statuses? It looks like they remain, even though I do call the CLEAR_DATA actionType
    Јане Џумеркоски
    @janedzumerko
    @benomatis how do you use CLEAR_DATA actionType to clear firestore data ?
    benomatis
    @benomatis
    @janedzumerko dispatch({ type: actionTypes.CLEAR_DATA })
    Јане Џумеркоски
    @janedzumerko
    Did you extended the requestedReducer with CLEAR_DATA ?
    benomatis
    @benomatis
    @janedzumerko I honestly don't know how I'd go about to do that.
    Elad Karni
    @EladKarni

    Hello
    Any ideas why this only works without the isCompleted check?

    useFirestoreConnect(() => [
        {
          collection: `Firms/${firmId}/activities`,
          where: [
            ['clientId', '==', client.id],
            ['type', '==', 'task'],
            ['isCompleted', '==', 'false'], // Works if I remove this, but doesn't get the data I want
          ],
          storeAs: `${userId}/clients/${client.id}/incompleteTasks`,
        },
      ]);

    right now it returns []

    benomatis
    @benomatis
    @EladKarni could it be that you look for a string as a value instead of a boolean?, ie. you have 'false' (with single quotes) while a boolean would be false (no quotes)... just a wild guess
    Marsunpaisti
    @Marsunpaisti
    Any idea why I'm getting Uncaught Error: FIREBASE FATAL ERROR: Cannot parse Firebase url please use https://<YOUR FIREBASE>.firebaseio.com even though my firebaseconfig is copypasted from the console?
    Some parts like auth are already working but I'm getting that when I try to use useFirebaseConnect
    Marsunpaisti
    @Marsunpaisti
    hell, even when I access the database url with my browser I can get data out with http requests
    Marsunpaisti
    @Marsunpaisti
    ah, updated the firebase package ( from yesterdays version ) and it works
    Marsunpaisti
    @Marsunpaisti
    Is there a reason that firebase.logout() clears data from firebase.data even though said data is not gated behind authentication
    I got a collection thats available for read without login and for some reason logging out clears it from redux
    Elad Karni
    @EladKarni

    @EladKarni could it be that you look for a string as a value instead of a boolean?, ie. you have 'false' (with single quotes) while a boolean would be false (no quotes)... just a wild guess

    That was it!!! Clearly I'm just an idiot lol

    Tim Arnold
    @TMcLoone
    is there a way to clear any firestore listeners (set up with useFirestoreConnect) on logout?
    Matthias Schmid
    @mschmid
    Hi there! Great to have such a community here. I have a (probably newbie) question. I would like to go from plain objects from Firestore DB to more type-safe typescript classes. The official docs mention a FirestoreDataConverter. Is something similar also supported within redux-firebase / redux-firestore?
    benomatis
    @benomatis
    Cloud Functions don't work at all, so it seems, I had to create a separate hook only to initiate functions, and so it's only available in a component scope, not outside (ie. in a thunk). Is this by design? My use case is simply to execute callable functions.
    Alex
    @a-zen

    Hi, how can I wait for data loading before putting the values into a state? I want to retrieve data and present a form where the data can be manipulated by the user. It looks something like this:

    useFirestoreConnect([ { collection: auth.uid, doc: profile, storeAs: 'profile', }, ]);
    const profile = useSelector((state) => state.firestore.data['profile']); const [name, setName] = useState(profile.name);

    I get an error that 'profile.name' is not defined, probably because the data is not yet loaded. But I can't use isLoaded because of the useState.
    If I do a setName(profile.name)after the isLoaded check I get an infinite render error.

    mcardinalupgrade
    @mcardinalupgrade
    Hello, I've been stuck on something unexpected for the past couple of hours... I am using the createUser function to provision a user with a username+password and specify things like firstname, lastname, email in the profile payload. That information gets reflected in firebase auth + firestore as expected. My issue is then I call signIn with the same user+pass (so a signInWithEmailAndPassword), I successfully log in, I see the @@reactReduxFirebase/LOGIN trigger but the store profile node stays in isEmpty: true, isLoaded: false. Is this an expected behavior? I thought the profile would load upon a successful login. Thanks for your help!
    BahaaAS
    @BahaaAS
    This message was deleted
    7 replies
    Frode Sjovatsen
    @fsjovatsen
    Hello! Is there a way to trigger some code when a @@reduxFirestore/DOCUMENT_MODIFIED action is triggered. When I add/update a document in Firestore I have triggers server side that updates other documents. I want to be able to visualize that in my app.
    Benjamin
    @benjaminshafii

    Hey I have a design decision question:

      const teamId = useSelector((state) => state.firebase.data.profile.teamId);
      useFirestoreConnect({collection: 'rooms', where: ["team", '==', teamId || '']})

    How would you design your app to handle it knowing that team could be undefined which could in turn cause something like a "missing permissions error" (because of the empty string)

    Only solution I found was to have dumy components just waiting on the selectors

    const WaitUntilReady = () => {
      const teamId = useSelector(state => firebase.data.profile.teamId)
      if (!teamId) return null
    
       return <SomeComponentWithUseFirestoreConnect teamId={teamId} />
    }
    
    const SomeComponentWithUseFirestoreConnect = ({teamId}) => {
      useFirestoreConnect({collection: 'rooms', where: ["team", '==', teamId || '']})
     // render something
    }
    Nicole Latifi
    @NicoleLatifi

    Hello! First time posting here.

    We've been stuck on an error for several days now... Since updating react-redux-firebase from ^2.1.6 to ^3.9.0, we're getting the error TypeError: store.getState is not a function. when trying to build on iOs. This error is occurring in the second firestoreConnect:

    export default compose<any>(
     connect(
        (state: State): Partial<MVProps> => ({
          myUserId: get(state, 'user.profile.id'),
          villagers: getFromIds(state.users, state.users.villagers),
        })
      ),
      firestoreConnect(props => [
        {
          collection: 'rooms',
          where: [
            [`type`, '==', 'userToUser'],
            [`users.${props.myUserId}`, '==', true],
          ],
          storeAs: 'myRooms',
        },
      ]),
      firestoreConnect((_, store) => {
        const state = store.getState() as State;
        return flatten(
          defaultTo(state.firestore.ordered.myRooms, []).map((r: Room) =>
            keys(r.users).map((userId: string) => ({
              collection: 'users',
              where: ['userId', '==', userId],
              storeAs: 'myRoomsUsers',
            }))
          )
        );
      }),
      connect(
        (state: State): Partial<MVProps> => ({
          myRooms: state.firestore.ordered.myRooms,
          myRoomsUsers: state.firestore.data.myRoomsUsers,
        })
      )
    )(view);

    This codebase is still pretty new to us so we're still trying to work out exactly how the redux was set up and how firestoreConnect is being used here. We've tried refactoring how the store is created and we have tried updating other dependencies but still can't get past this error. If anyone has any insights about firestoreConnect() and getState() it would be most appreciated!

    Alex McKay
    @alexandermckay
    firestoreConnect only has one parameter: props. Docs here.
    Erin Untermeyer
    @ErinUntermeyer
    @alexandermckay Do you know how we would access the store in the 2nd firestoreConnect then? We inherited this codebase and it was working the way the code is written above prior to upgrading the react-redux-firebase dependency. We now cannot seem to get firestoreConnect to properly access the redux store.
    Gabriel Poussif
    @Gsiete

    Yeah it is like an elasticsearch as a service. Great if you aren't worried too much about costs, but if you are you can always run your own elasticsearch instance

    Anybody with experience on how to combine this with react-redux-firebase?

    Gabriel Poussif
    @Gsiete
    @prescottprue How should I combine react-redux-firebase with Algolia?
    Renato Formato
    @rformato
    Hi everyone, is there a way to add subcollections to the profile?
    I have a firestore db and i can read the user profile in state.firebase.profile
    I understand I can connect to the subcollection with firestore, but it won't be reflected in the profile object, so I was just wondering if there's an easy way to do it, or, and this is likely, maybe it's not a good idea?
    nemet4ndrea
    @nemet4ndrea
    Guys, does link from firebase.auth.photoURL still work for you? I see an avatar placehoder photo and something that now a token needs to be used to fetch the Facebook user photo
    nemet4ndrea
    @nemet4ndrea
    also do you know a good example that uses fetchProvidersForEmail to link multiple auth providers? Thanks!
    Try Space
    @TrySpace
    Hi! Question
    How to maintain/reuse state when queriying same collection again
    Not sure how it is meant to be used, but is there an existing way to keep the state of collections intact without removing the previous state?
    Every time a component renders with useFirestoreConnect, it will clear the existing store, which I'm not even sure if that's expected behaviour.
    It might also be why this issue: prescottprue/react-redux-firebase#914 is causing such a render-blocking issue, because instead of replacing them in quick succession, it is adding them, causing too many re-renders, where replacing them should cause minimal or no change at all.
    Simon B.
    @sesam
    Hi, is there any documentation for how state.firestore.composite behaves if I call useFirestoreConnect from different components that end up under the same key (so same collection, different where) ?
    Daniel Rodríguez Rivero
    @danielo515
    Seems this chat is dead right?
    Sherwin Mascarenhas
    @sherwinfarrell
    Hi i'm trying to source firebase data in react using redux. For this I am using the firebaseConnect component to source the data in to the component. I'm also, using useEffect with the [props.variable], since i've mapped the firebase state to props, but any change on firebase, with regard to the data, isn't being reflected on the ui and I need to force refresh.
    Try Space
    @TrySpace
    Anyone know a good example of doing pagination where you can also paginate back? And preferably where you have something like < 1 2 3 4 5 6 > and you can go to a specific page, but it's sorted by for example a date, I have no idea how to select a page with a plain number, it doesn't seem to exist? I'm breaking my head over how this is achieved, all I can find is infinite scroll loading use cases ( see for example: prescottprue/redux-firestore#346)
    Đặng Hữu Lộc
    @witcher-vae

    Hello everyone, help me, please!!!
    I use redux-toolkit template cra redux-typescript with react-redux-firebase and i got an error: Property 'firestore' does not exist on type 'DefaultRootState' but i added firestore:firestoreReducer to reducer in configureStore

    export const store = configureStore({
      reducer: {
        counter: counterReducer,
        firebase: firebaseReducer,
        firestore: firestoreReducer,
      },
      middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
          serializableCheck: {
            ignoredActions: [
              // just ignore every redux-firebase and react-redux-firebase action type
              ...Object.keys(rfConstants.actionTypes).map((type) => `${rfConstants.actionsPrefix}/${type}`),
              ...Object.keys(rrfActionTypes).map((type) => `@@reactReduxFirebase/${type}`),
            ],
            ignoredPaths: ['firebase', 'firestore'],
          },
          thunk: {
            extraArgument: {
              getFirebase,
            },
          },
        }),
    });
    
    export type AppDispatch = typeof store.dispatch;
    export type RootState = ReturnType<typeof store.getState>;
    export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, Action<string>>;

    Thanks very much

    Carlos A. Talero Jácome
    @felixback84
    Amartya982
    @Amartya982

    TypeError: Object(...) is not a function
    Module.<anonymous>
    C:/Users/Amartya/Desktop/Project/blog_s/client/src/index.js:15
    12 |
    13 | const store = createStore(rootReducer,
    14 | compose(

    15 | applyMiddleware(thunk.withExtraArgument({getFirebase, getFirestore})),
    16 | reactReduxFirebase(fbConfig), // redux binding for firebase
    17 | reduxFirestore(fbConfig) // redux bindings for firestore
    18 | )
    this is the problem I am facing when I am connecting react to firestore database

    can anyone help me out??
    Lucas Perrin
    @xlucxs
    Has someone a template how to configure react-redux-firebase V3 with react-native-firebase 6.x since it has been split up in differents modules ? thanks 😉

    I have tried

    import {createStore, applyMiddleware, compose} from 'redux';
    import rootReducer from '../Redux/Reducers/rootReducer';
    import middlewares from '../Redux/Middleware/middleware';
    import {createFirestoreInstance} from 'redux-firestore'; // <- needed if using firestore
    // import {createFirebaseInstance} from 'react-redux-firebase';
    
    // Cherry-pick modules of react-native-firebase 6.x
    // import '@react-native-firebase/analytics';
    import '@react-native-firebase/auth';
    // import '@react-native-firebase/crashlytics';
    // import '@react-native-firebase/dynamic-links';
    import '@react-native-firebase/firestore';
    // import '@react-native-firebase/perf';
    // import '@react-native-firebase/remote-config';
    
    import RNfirebase from '@react-native-firebase/app';
    
    const firebase = RNfirebase.app();
    
    const initialState = {};
    
    // react-redux-firebase config
    const rrfConfig = {
      userProfile: 'users',
      useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB
      // enableClaims: true // Get custom claims along with the profile
      presence: 'presence', // where list of online users is stored in database
      sessions: 'sessions', // where list of user sessions is stored in database (presence must be enabled)
      enableRedirectHandling: false, // <--- required when using react-native
    };
    
    // Create store with reducers and initial state
    export const store = createStore(
      rootReducer,
      initialState,
      compose(applyMiddleware(...middlewares)),
    );
    
    export const rrfProps = {
      firebase,
      config: rrfConfig,
      dispatch: store.dispatch,
      createFirestoreInstance, // <- needed if using firestore
    };

    The given error:
    Possible Unhandled Promise Rejection (id: 0):
    TypeError: getFirebase is not a function
    Possible Unhandled Promise Rejection (id: 1):
    Error: You attempted to use "firebase.app('[DEFAULT]').database" but this module could not be found.

    benomatis
    @benomatis
    Hi Guys! Is there any reason why when setting up listeners for firestore collections, adding a 2nd listener on the same collection wipes the previous data stored in redux? Is there any way to merge the data coming via the 2nd listener?
    1 reply
    polisen
    @polisen
    Hey
    Has anyone been able to figure out how to use firebase v9 with redux efficiently
    MUHAMMAD ZIKRI BIN MOHD YUNAN
    @DrPolymath
    Hello everyone, I need help. I have collection called carBrand with props carBrandName and its subcollection called carModel with props carModelName. How can I use firestoreConnect to grab both carBrandName and carModelName linked with each other and store in one object array.