IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

No results #73

Closed RWOverdijk closed 5 years ago

RWOverdijk commented 5 years ago

Env:

I just tried using this.. Module? Library?.. Code.

I had this with react-native-firebase:

firestore.collection('chats').where('members', 'array-contains', uid).onSnapshot(async (a) => {
  this.setState({ chats });
});

And now did this with firestorter:

// Above the component class
initFirestorter({ firebase });

const chatCollection: any = new Collection('chats', {
  query: (ref: any) => ref.where('members', 'array-contains', auth.currentUser!.uid)
});

chatCollection.docs is always empty whereas this.state.chats isn't. Am I missing something?

RWOverdijk commented 5 years ago

Apparently nothing happens if your component isn't observed. Makes sense.