code
export default combineReducers(
{
firebase: firebaseReducer,
firestore: firestoreReducer, }
);code
it doesnt seem to occur when i comment the firestore line
const mapState = (state) => {
// …
return { requesting: state.firestore.status.requesting }
}
// …
render() {
const { requesting } = this.props;
const loading = Object.values(requesting).some(a => a === true); // see if any objects exist
if (requesting) return <MyLoadingComponent />;
// …render component as usual
isLoaded
to check whether the todos object is loaded from firestore and forgot to add my other object into the checking after I modified the structure of my database, which has been haunting me for all these days.
isLoaded
is maintained by react-redux-firebase
’s reducers throughout all of its reducers’ actions.
isLoaded
is maintained for auth
and profile
. I doesn’t seem to come into play for listeners?
I’ve added a comment to an already-closed bug that I believe is related. Hopefully we’ll get clarification and then a docs update (if not a behaviour change):
useFirestoreConnect()
. Haven’t been able to wrap my head around what that code would look like. Thoughts/examples/pointers?
where(“status”, “==”, “todo”)
and where(“status”, “==“, “done”)
), and a detail screen where I toggle the “status” field, returning to the lists doesn’t always show them updated.
useFirestoreConnect
and useSelector
to distinguish between “data not yet loaded”, versus “no such results” ? From my testing, both situations seem to result in a redux node that has an empty array? Or maybe the queries are coming back so quickly that i’m just not catching the “still loading”?
isLoaded()
and isEmpty()
…. which I probably am elsewhere and my feable brain has purged that data for being too long out of use.
Hello, what an awesome library!
I want to implement Firestore pagination feature, I tried this:
const [fetchData, setFetchData] = useState({ start: 0, count: 3, data: [], length: 0, deleted: false })
const { auth, profile } = useSelector(state => state.firebase)
useFirestoreConnect([{collection: 'WithdrawalRequests', where: ['uid', '==', auth.uid], orderBy: ['reqdate','desc'], startAfter: fetchData.start, limit: fetchData.count}])
const fetchReq = useSelector(state => state.firestore.ordered.WithdrawalRequests)
useEffect(()=>{
fetchReq && setFetchData(prevFData=>{console.log(fetchReq)
let xdata = prevFData.data;
if(fetchData.newElem) {
return {...prevFData,length:fetchReq.length,data:fetchReq}
}
if(fetchData.data.length===0){
fetchReq.push(...xdata)
return {...prevFData,length:fetchReq.length,data:fetchReq}
}
if(fetchData.update) {
xdata.push(...fetchReq)
return {...prevFData,length:fetchReq.length,update:false,data:xdata}
}
})
},[fetchReq])
This works on the page's first visit, but when I navigate to another page and come back to this, it crashes saying:Cannot read property 'start' of undefined
My state fetchData gets undefined.
I also checked whether the listeners and queries in the redux DevTools, but everything looks fine there.
Please help!
I switched to using doc IDs instead of references and managed to get data using hooks like this:
const populates = [{ child: `video`, root: `videos` }]
const collection = `projects`
...
useFirestoreConnect(() => [
{ collection, doc: id, populates }
])
const item = useSelector(({ firestore }) => populate(firestore, collection, populates)?.[id])
I wonder now if it does query for all of the Docs in videos
collection each time? So if videos
will have 50 million records then will it request all of them each visit or only the ones that will be used for population of projects
?
Hi all, I'm running into a version this issue: (prescottprue/redux-firestore#174)
I've got a user profile page that shows all of a user's "logs", so I'm setting a listener for:
{
collection: 'myCollection',
doc: myDocId,
subcollections: [{ collection: 'logs' }],
where: [
['showInFeed', '==', true],
['userId', '==', userId],
],
orderBy: [['submittedAt', 'desc']],
storeAs: participantHighlights-${userId}
,
}
The problem is on initial load, firestore recognizes (I guess?) that I've already seen a few logs from a different query that matches the parameters, and auto-populates them. But after that, it goes and does a "DOCUMENT_ADDED" for each individual doc after those initial ones.
I've tried manually setting the listener and it didn't fix it. Is there a known way to prevent spam from DOCUMENT_ADDED?