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

331
Views
Carga inicial lenta para datos API

Tema:

  • La aplicación NextJS tarda ~20 segundos en cargar la página con getServerSideProps o getStaticProps
  • Después de la carga inicial, todo funciona bien.
  • El problema se repite después de que el sitio esté inactivo durante aproximadamente 10 minutos o más
  • Este problema no ocurre cuando npm run build y luego npm run start desde mi máquina local, pero sí en el sitio en vivo y npm run dev
  • La API está alojada actualmente con Strapi en Heroku (nivel gratuito)
  • Exactamente lo mismo sucede en otro sitio con datos alojados en MongoDB (Nivel M10)

Código para la página:

 const Index = ({ properties, total }) => { return ( <Container> <DashboardDrawer /> <Search /> <PropertyList properties={properties} /> <Pagination page={1} total={total} /> </Container> ); }; export default Index; export const getServerSideProps = async ({ query: { page = 1 } }) => { // Calculate start page const start = +page === 1 ? 0 : (+page - 1) * PER_PAGE; // Fetch total/count const totalRes = await fetch(`${API_URL}/properties/count`); const total = await totalRes.json(); // Fetch properties const propertyRes = await fetch( `${API_URL}/properties?_limit=${PER_PAGE}&_start=${start}` ); const properties = await propertyRes.json(); return { props: { properties, page: +page, total }, }; };
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!