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

94
Views
Firebase Reads Suddenly Spiked with 54k

I am just getting my feet wet with firebase and in initial development, suddenly I get an error:

FirebaseError: Quota exceeded.

For context, I'm building a simple blog in React. It's saying the my function read problem is at "getPosts()":

import { useEffect, useState } from 'react';
import { getDocs, collection } from 'firebase/firestore';
import { db } from '../firebase-config';
import './Home.css';

const Home = () => {
  const [postList, setPostList] = useState([]);
  const postCollectionRef = collection(db, 'posts');

  useEffect(() => {
    const getPosts = async () => {
      const data = await getDocs(postCollectionRef);
      setPostList(data.docs.map(doc => ({ ...doc.data(), id: doc.id })));
    };
    getPosts();
  });
  return (
    <div className="homePage">
      {postList.map(post => {
        return (
          <div className="post">
            <div className='postHeader'>
            <div className='post-title'><h1>{post.title}</h1></div>
            <div className='post-author'><h5>{post.author.name}</h5></div>
            </div>
            <div className='post-content'>{post.postText}</div>
          </div>
        );
      })}
    </div>
  );
};

export default Home;

So as I'm searching around the settings I find this graph that completely confounds me. Maybes someone can tell me what happened here.

Graph showing reads spiking 54k at once.

Is mapping over the data this way accumulated 50k reads at once somehow?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Your useEffect doesn't have a dependency array, so it will fire indefinitely. Add an empty dependency array at the end of your useEffect to only fire it on mount.

  useEffect(() => {
    (async () => {
      const { docs } = await getDocs(postCollectionRef);

      setPostList(docs.map(doc => ({ ...doc.data(), id: doc.id })));
    })();
  }, []);

Learn more about it here

about 4 years ago · Santiago Gelvez Report
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!