New strapi article not showing with nextjs Frontend

[details=“System Information”]

  • 4.13.6:
  • Windows:
  • PostgreSql:
  • >=16.0.0 <=20.x.x:
  • >=6.0.0:
  • Yarn Version:

Im facing: my blogs post from strapi admin hosted on DigitalOcean App platform not showing latest articles…
When i try to change the pageSize = 9 → 3 it shows latest one otherwise it shows old…

here is the code:

export default async function LatestNews({ searchParams }) {
const { page } = searchParams;
const pageParam = page === undefined ? 1 : page;
const data = await getPosts(pageParam);

return (





);
}

async function getPosts(pageParam) {
console.log(pageParam, “Pageparam”);
const res = await fetch( ${process.env.NEXT_PUBLIC_STRAPI_URL}/blogs?pagination[page]=${pageParam}&pagination[pageSize]=9&sort[0]=id:desc&populate=*);

if (!res.ok) {
throw new Error(“Failed to fetch data from API”);
}
return res.json();
}

this is my code and that is what i was getting in log :

1 Pageparam
{
data: [
{ id: 36, attributes: [Object] },
{ id: 35, attributes: [Object] },
{ id: 34, attributes: [Object] },
{ id: 33, attributes: [Object] },
{ id: 32, attributes: [Object] },
{ id: 31, attributes: [Object] },
{ id: 30, attributes: [Object] },
{ id: 29, attributes: [Object] },
{ id: 28, attributes: [Object] }
],
meta: { pagination: { page: 1, pageSize: 9, pageCount: 4, total: 34 } }
} Blogs


When i change the [pageSize]=9 - [pageSize]=3

then it shows latest blogs here is the log:

1 Pageparam
{
data: [
{ id: 40, attributes: [Object] },
{ id: 39, attributes: [Object] },
{ id: 38, attributes: [Object] }
],
meta: { pagination: { page: 1, pageSize: 3, pageCount: 13, total: 38 } }
} Blogs