Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
React - Fetch request stalls when receiving large Json array

In my app, I am trying to do a fetch request, save the incoming json array in state, and display this data in a table. This functionality works completely fine when the number of json objects in the array is about 200. However this array size can increase in size depending on filters selected in the app. When this array is over 600 for example, the request will hang and eventually will fail to return anything, giving error 502. Keep in mind, the data is received and displayed as it should if the array is smaller.

    fetch(URL, {
      headers: {
        "accept": "*/*",
        "Content-Type": "application/json",
      },
      method: "POST",
      body: JSON.stringify(searchBody),
    })
    .then(response => response.json())
    .then(data => {
      console.log(data)
      setSearchData(data);
    },
    (error) => {
      NotificationManager.error("Search Error");
      console.log(error)
  });

The above is the fetch request. I first tried to fix this by adding pagination to the table, however the error doesnt seem to be with the displaying but the response itself, as nothing is returned after sending the fetch. I cannot seem to find clear answers as how to limit the size of incoming response in chunks if that will solve the issue. Any help is greatly appreciated :)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda