Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
NextJs GetServerSideProps after update how can i call?

Below I am pulling all the data from the database. But let's say I deleted one piece of data. How can I retrieve the renewed data? How can I run it again?

export async function getServerSideProps() {
  const res = await fetch(`http://localhost:8000/api/getAllShipmentTypes`);
  const shipmentTypes = await res.json();

  return {
    props: { shipmentTypes } // will be passed to the page component as props
  };
}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

But let's say I deleted one piece of data. How can I retrieve the renewed data?

I think you will need to define what is the trigger for the deletion, I can think of these two.

  1. Another action user performs on a page.
  2. Some other system modifying the database that this client application shows.

For #1, To the action, say a button click you can use a router object to set the same route again which will run getServerSideProps again

When you request this page on client-side page transitions through next/link or next/router, Next.js sends an API request to the server, which runs getServerSideProps

For #2 - this would be handled by giving the user an option to refetch the data from the server again using a link or router component

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda