Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
My code generated 45k Reads on Firebase in 5 minutes but I have only 5 documents and I'm the only one using it

I am implementing a products directory using Firebase & React but there's something I just can't understand when I query my products. My landing page contains 4 tiles for the 4 main categories of products and I want to fetch the 3 most popular products for each category. For now I invoke 4 components which contain this function :

const [products, setProducts] = useState([]);

  async function fetchProducts() {
    const q = query(
      collection(db, "products"),
      where("category", "==", props.slug),
      orderBy("votes", "desc"),
      limit(3)
    );
    const querySnapshot = await getDocs(q);
    const prod = [];
    querySnapshot.forEach((doc) => {
      prod.push(doc.data());
    });
    setProducts(prod);
  }
  useEffect(() => {
    fetchProducts();
  });

My code works but I can't figure out the tremendous amount of reads anytime I hit npm run to test my code. There are only 5 products in the db but running my code on localhost for around 5 minutes generated 45k reads... any idea why that is ? Thanks a lot ! 44k reads in 5 minutes

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!