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

269
Views
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 answers
Answer question

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 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!