fix: disable caching for total post count GROQ queries
This commit is contained in:
parent
b04a49f3e3
commit
a51372e7c9
2 changed files with 10 additions and 2 deletions
|
@ -50,7 +50,11 @@ export async function POST(req: NextRequest) {
|
|||
const cardsPerPage = 6;
|
||||
|
||||
const totalPostsQuery = `count(*[_type == 'blog'])`;
|
||||
const totalPosts: number = await client.fetch(totalPostsQuery);
|
||||
const totalPosts: number = await client.fetch(
|
||||
totalPostsQuery,
|
||||
{},
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
|
||||
const totalPages = Math.ceil(totalPosts / cardsPerPage);
|
||||
for (let i = 1; i <= totalPages + 1; i++) {
|
||||
|
|
|
@ -48,7 +48,11 @@ const BlogCards: React.FC<BlogCardInterface> = async (props) => {
|
|||
);
|
||||
|
||||
const totalPostsQuery = `count(*[_type == 'blog'])`;
|
||||
const totalPosts: number = await client.fetch(totalPostsQuery);
|
||||
const totalPosts: number = await client.fetch(
|
||||
totalPostsQuery,
|
||||
{},
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
|
||||
const totalPages = Math.ceil(totalPosts / cardsPerPage);
|
||||
|
||||
|
|
Loading…
Reference in a new issue