fix: don't cache Sanity GROQ queries
This commit is contained in:
parent
9c8a5a479d
commit
3e2bcab3ce
3 changed files with 11 additions and 3 deletions
|
@ -28,7 +28,7 @@ async function getData(slug: string) {
|
|||
_createdAt
|
||||
}[0]`;
|
||||
|
||||
const data = await client.fetch(query);
|
||||
const data = await client.fetch(query, {}, { cache: "no-store" });
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,11 @@ export async function generateStaticParams() {
|
|||
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);
|
||||
|
||||
|
|
|
@ -41,7 +41,11 @@ const BlogCards: React.FC<BlogCardInterface> = async (props) => {
|
|||
_createdAt
|
||||
}[${(currentPage - 1) * cardsPerPage}...${currentPage * cardsPerPage}]`;
|
||||
|
||||
const posts: BlogPostcard[] = await client.fetch(query);
|
||||
const posts: BlogPostcard[] = await client.fetch(
|
||||
query,
|
||||
{},
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
|
||||
const totalPostsQuery = `count(*[_type == 'blog'])`;
|
||||
const totalPosts: number = await client.fetch(totalPostsQuery);
|
||||
|
|
Loading…
Reference in a new issue