Skip to content

Commit 1d1ac4e

Browse files
codercatdevAlex Patterson
andauthored
revalidate issue (#587)
* fix settings ogImage * update types --------- Co-authored-by: Alex Patterson <alex.patterson@fusionauth.io>
1 parent 4e6f186 commit 1d1ac4e

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎sanity.types.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ export declare const internalGroqTypeReferenceTo: unique symbol;
12611261
// Query: count(*[_type == $type])
12621262
export type DocCountResult = number;
12631263
// Variable: settingsQuery
1264-
// Query: *[_type == "settings"][0]
1264+
// Query: *[_type == "settings"][0]{ ..., ogImage{ secure_url }}
12651265
export type SettingsQueryResult = {
12661266
_id: string;
12671267
_type: "settings";
@@ -1293,7 +1293,9 @@ export type SettingsQueryResult = {
12931293
sideOnly?: boolean;
12941294
_key: string;
12951295
}>;
1296-
ogImage?: CloudinaryAsset;
1296+
ogImage: {
1297+
secure_url: string | null;
1298+
} | null;
12971299
} | null;
12981300
// Variable: homePageQuery
12991301
// Query: *[_type == "settings" ][0]{ "featuredCourse": *[_type == "course" && featured > 0]|order(featured desc)[0]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), stripeProduct, }, "featuredCourses": *[_type == "course" && featured > 0]|order(featured desc)[0...4]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), stripeProduct, }, "latestPodcast": *[_type == "podcast"]|order(date desc)[0]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), }, "topPodcasts": *[_type == "podcast" && views > 0]|order(views desc)[0...4]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), }, "latestPosts": *[_type == "post"]|order(date desc)[0...4]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), }, "topPosts": *[_type == "post" && views > 0]|order(views desc)[0...4]{ _id, _type, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _createdAt), },}

‎sanity/lib/fetch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ export async function sanityFetch<QueryResponse>({
4747
useCdn: true,
4848
// Only enable Stega in production if it's a Vercel Preview Deployment, as the Vercel Toolbar supports Visual Editing
4949
// When using the `published` perspective we use time-based revalidation to match the time-to-live on Sanity's API CDN (60 seconds)
50-
next: { revalidate: 0 },
50+
next: { revalidate: 60 },
5151
});
5252
}

‎sanity/lib/queries.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { groq } from "next-sanity";
22

33
export const docCount = groq`count(*[_type == $type])`;
44

5-
export const settingsQuery = groq`*[_type == "settings"][0]`;
5+
export const settingsQuery = groq`*[_type == "settings"][0]{
6+
...,
7+
ogImage{
8+
secure_url
9+
}
10+
}`;
611

712
// Partials
813

0 commit comments

Comments
 (0)