prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 559 forks source link

firestore connect loading everything before applying filter #943

Closed jaddoescad closed 4 years ago

jaddoescad commented 4 years ago

I have the following code to load content based on a specific Id:

  const query = { collection: 'coursesCreated', where: [["userId", "==", "GYOhCRnAAiMLPvT0GUU0mA5jBph2"]] };
  useFirestoreConnect([query]);
  const coursesCreated = useSelector(state => state.firestore.data);

unfortunately, use selector loads all the data the first time. then loads the filter the second time. Not sure if this is a bug or if i'm missing something.

Screen Shot 2020-05-23 at 1 45 56 PM

Why does it load twice, and how can I limit the load to just one with the right where statement?

jaddoescad commented 4 years ago

using storeas fixes my issue, but still not sure why this happens