I am quite new to Sanity v3 + Next.js v13. Everything works great on my test site, but I have a problem when I update a document (project) or add a new one in the Sanity Studio – these changes are not updated on the pages. I am still on localhost. I want to see the changes right after they are made. If I update the query and save the file, the elements will be updated. Is it some kind of caching issue?
My example is here:
export async function getProjects(): Promise<Project[]> {
return createClient(clientConfig).fetch(
groq`*[_type=="project"]|order(_createdAt desc){
_id,
_createdAt,
name,
"slug": slug.current,
"image": image.asset->url,
url,
content
}`
);
}
*** exported clientConfig ***
const config = {
projectId: "xxxxxx",
dataset: "production",
apiVersion: "v1",
};
export default config;
To show new projects, you will have to do the following:
Above both of your export default functions, add the following: