Description
It would be great if I could access the original firestore client API objects through this library as well.
This begins at accessing the original firestore
object I am passing over to the redux-firestore store enhancer and ends at the individual document snapshots I get back from api calls.
A simple example is that I would like to query the next set of documents within a collection startingFrom
a document snapshot
like described in the Firestore Documentation. This already works with redux-firestore
, but I have to get the original document snapshot again myself as its not available through the store:
// Pseudo code
// Get Redux-Firestore Object from Store
const { firestore } = this.store;
// Get current State from Store
const { firestore: { ordered: { 'cars.1': items } } } = this.store.getState();
// Get Snapshot of the last queried document
var snapshot = await firestore.collection( 'cars' ).doc( items[ items.length - 1 ].id ).get();
// Do the firestore query with startFrom = snapshot to get the next page of results
firestore.get( {
collection: 'cars',
limit: 10,
startAfter: snapshot
} );
This is suboptimal as redux-firestore should already have this snapshot, but it throws it away and only stores the data of each document snapshot.
Activity