ISSUE
I'm encountering an issue where I am unable to fetch documents from a Firestore collection when the page loads. Despite executing the query multiple times during loading, it does not return any results. However, if I trigger the query by changing a state through a page button, then it successfully retrieves the results.
QUERIES
I suspect that the problem might be related to Firebase initialization. How can I ensure that the query functions properly during page load so that it can display information fetched from the database?
CODE DETAILS
My code includes firebase.js, where all the database-related code is stored. Additionally, I have a dashboard component that executes the query, sets the results as states, and passes them to child components for rendering purposes. Despite calling the query repeatedly on page load, no results are displayed. It's only after some delay and re-calling the query that results are obtained.
firebase.js
...
(Insert your unique content here)
...
Dashboard.js
...
(Insert your unique content here)
...