Skip to content

Commit

Permalink
fix(warnings): eliminating setup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Jan 16, 2025
1 parent a57cc49 commit dc70eef
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 25 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use-node-version=18.20.5
1 change: 1 addition & 0 deletions src/machines/auth-token-polling-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const POLLING_LIMIT = 5

export const authTokenPollingMachine = createMachine<Context, Event>(
{
predictableActionArguments: true,
initial: 'pending',
context: {
stripeCheckoutSessionId: undefined,
Expand Down
1 change: 1 addition & 0 deletions src/machines/commerce-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const commerceMachine = createMachine<
CommerceMachineEvent
>(
{
predictableActionArguments: true,
id: 'commerce',
context: {
pricingData: {} as PricingData,
Expand Down
1 change: 1 addition & 0 deletions src/machines/confirmation-dialog-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const confirmationDialogMachine = createMachine<
ConfirmationDialogMachineEvent
>(
{
predictableActionArguments: true,
id: 'confirmationDialog',
initial: 'closed',
context: {
Expand Down
1 change: 1 addition & 0 deletions src/machines/strong-confirmation-dialog-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const strongConfirmationDialogMachine = createMachine<
StrongConfirmationDialogMachineEvent
>(
{
predictableActionArguments: true,
id: 'confirmationDialog',
initial: 'closed',
context: {
Expand Down
72 changes: 54 additions & 18 deletions src/pages/[post].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,47 @@ interface PostQueryResult {
post: Post
}

// Type for MDX source
type MDXSource = {
compiledSource: string
scope?: Record<string, unknown>
}

// Type for tags
type Tag = {
name: string
label: string
image_url?: string
version?: string
}

// Update component props
interface PostPageProps {
mdxSource: MDXSource
post: Post
instructor: {
full_name: string
avatar_url: string
path?: string
}
videoResource: {
fields: {
muxPlaybackId: string
transcript?: string
}
}
tags: Tag[]
}

// Update event type for MuxPlayer
type MuxTimeUpdateEvent = {
currentTarget: MuxPlayerElement
}

async function getPost(slug: string) {
console.log('Getting post for slug:', slug)
const {hashFromSlug, originalSlug} = parseSlugForHash(slug)
console.log('Parsed slug:', {hashFromSlug, originalSlug})

const conn = await mysql.createConnection(access)

Expand All @@ -165,8 +204,9 @@ async function getPost(slug: string) {
`,
[slug, slug, `%${hashFromSlug}`, `%${hashFromSlug}`],
)
console.log('Video resource rows:', videoResourceRows)

// Get post data
// Get post data with proper type checking
const [postRows] = await conn.execute<RowDataPacket[]>(
`
SELECT cr_lesson.*, egh_user.name, egh_user.image
Expand All @@ -177,24 +217,30 @@ async function getPost(slug: string) {
`,
[slug, slug, `%${hashFromSlug}`, `%${hashFromSlug}`],
)
console.log('Post rows:', postRows)

const videoResource = videoResourceRows[0]
const postRow = postRows[0]

if (!postRow) {
console.log('No post found for slug:', slug)
return null
}

// Validate post data against schema
const postData = PostSchema.safeParse(postRow)
if (!postData.success) {
throw new Error('Invalid post data', {
cause: postData.error.message,
})
console.error('Post validation failed:', postData.error)
throw new Error(`Invalid post data: ${postData.error.message}`)
}

return {
videoResource,
post: postData.data,
}
} catch (error) {
console.error(error)
return null
console.error('Error in getPost:', error)
throw error
} finally {
await conn.end()
}
Expand Down Expand Up @@ -352,17 +398,7 @@ export default function PostPage({
instructor,
mdxSource,
tags,
}: {
mdxSource: any
post: Post
instructor: {
full_name: string
avatar_url: string
path?: string
}
videoResource: any
tags: any
}) {
}: PostPageProps) {
const imageParams = new URLSearchParams()
imageParams.set('title', post.fields?.title ?? '')

Expand Down Expand Up @@ -745,7 +781,7 @@ const PoweredByMuxBadge = () => {
clipRule="evenodd"
/>
<path
d="m108.38 6.258 2.198 5.824 2.128-5.824h1.218l-3.29 8.344a6.6 6.6 0 0 1-.448.966c-.14.224-.294.378-.49.476-.196.112-.462.154-.784.154h-1.372v-1.05h1.022c.224 0 .392-.014.504-.07a.5.5 0 0 0 .266-.224c.07-.112.154-.294.266-.546l.364-.854-2.8-7.196zM105.171 6.608q.777.441 1.218 1.26c.294.56.448 1.204.448 1.96 0 .728-.154 1.358-.448 1.904-.294.56-.7.98-1.218 1.288a3.46 3.46 0 0 1-1.764.462c-.588 0-1.078-.098-1.484-.308a2.33 2.33 0 0 1-.966-.868l-.154 1.092h-.994v-9.8h1.148v3.808c.588-.812 1.414-1.232 2.45-1.232.658 0 1.246.154 1.764.434m-.168 5.124c.434-.49.658-1.12.658-1.904 0-.77-.224-1.4-.658-1.89s-1.008-.742-1.708-.742c-.462 0-.868.112-1.232.336s-.63.532-.826.924q-.294.588-.294 1.344 0 .777.294 1.386c.196.406.462.714.826.938s.77.336 1.232.336c.7 0 1.274-.238 1.708-.728M93.881 3.598v9.8h-.994l-.154-1.148c-.602.826-1.414 1.232-2.45 1.232-.672 0-1.26-.14-1.778-.434q-.777-.42-1.218-1.26c-.294-.546-.434-1.204-.434-1.96 0-.714.14-1.344.434-1.904.294-.546.7-.98 1.232-1.288q.777-.462 1.764-.462c.574 0 1.064.112 1.484.322.406.21.728.49.966.854V3.598zm-2.268 8.54q.546-.336.84-.924c.196-.392.294-.854.294-1.358a3.1 3.1 0 0 0-.294-1.372 2.23 2.23 0 0 0-.84-.952 2.3 2.3 0 0 0-1.218-.336c-.714 0-1.288.252-1.722.742s-.644 1.12-.644 1.89c0 .784.21 1.414.644 1.904s1.008.728 1.722.728c.448 0 .854-.098 1.218-.322M79.44 7.91c.28-.546.685-.966 1.203-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918m5.165 1.19c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM78.632 6.258v1.12h-.574c-.686 0-1.176.238-1.47.686-.294.462-.434 1.022-.434 1.694v3.64h-1.148v-7.14H76l.154 1.078c.196-.322.462-.588.798-.784.322-.196.77-.294 1.358-.294zM67.34 7.91c.28-.546.686-.966 1.204-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918m5.166 1.19c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM55.754 6.258h1.204l1.778 5.81 1.876-5.81h1.064l1.778 5.81 1.862-5.81h1.162l-2.38 7.14h-1.26l-1.722-5.306-1.792 5.306-1.26.014zM49.924 13.02a3.16 3.16 0 0 1-1.246-1.288c-.308-.546-.448-1.176-.448-1.904 0-.714.14-1.344.448-1.904.294-.546.714-.98 1.246-1.288q.798-.462 1.848-.462c.686 0 1.302.154 1.834.462s.952.742 1.26 1.288c.294.56.448 1.19.448 1.904 0 .728-.154 1.358-.448 1.904a3.3 3.3 0 0 1-1.26 1.288c-.532.308-1.148.462-1.834.462q-1.05 0-1.848-.462m3.08-.896a2.2 2.2 0 0 0 .84-.938c.196-.392.294-.854.294-1.358s-.098-.952-.294-1.358a2.27 2.27 0 0 0-.84-.938 2.3 2.3 0 0 0-1.232-.336c-.476 0-.882.112-1.246.336s-.63.546-.826.938a3.1 3.1 0 0 0-.294 1.358c0 .504.098.966.294 1.358.196.406.462.714.826.938s.77.336 1.246.336c.462 0 .868-.112 1.232-.336M45.504 6.608q.777.441 1.218 1.26c.294.56.448 1.204.448 1.96 0 .728-.154 1.358-.448 1.904-.294.56-.7.98-1.218 1.288a3.46 3.46 0 0 1-1.764.462c-.588 0-1.078-.098-1.484-.308a2.33 2.33 0 0 1-.966-.868v3.892h-1.148v-9.94h.994l.154 1.148c.588-.812 1.414-1.232 2.45-1.232.658 0 1.246.154 1.764.434m-.168 5.124c.434-.49.658-1.12.658-1.904 0-.77-.224-1.4-.658-1.89s-1.008-.742-1.708-.742c-.462 0-.868.112-1.232.336s-.63.532-.826.924q-.294.588-.294 1.344 0 .777.294 1.386c.196.406.462.714.826.938s.77.336 1.232.336c.7 0 1.274-.238 1.708-.728M29.772 13.02a3.16 3.16 0 0 1-1.246-1.288c-.308-.546-.448-1.176-.448-1.904 0-.714.14-1.344.448-1.904.294-.546.714-.98 1.246-1.288q.798-.462 1.848-.462c.686 0 1.302.154 1.834.462s.952.742 1.26 1.288c.294.56.448 1.19.448 1.904 0 .728-.154 1.358-.448 1.904a3.3 3.3 0 0 1-1.26 1.288c-.532.308-1.148.462-1.834.462q-1.05 0-1.848-.462m3.08-.896a2.2 2.2 0 0 0 .84-.938c.196-.392.294-.854.294-1.358s-.098-.952-.294-1.358a2.27 2.27 0 0 0-.84-.938 2.3 2.3 0 0 0-1.232-.336c-.476 0-.882.112-1.246.336s-.63.546-.826.938a3.1 3.1 0 0 0-.294 1.358c0 .504.098.966.294 1.358.196.406.462.714.826.938s.77.336 1.246.336c.462 0 .868-.112 1.232-.336M20.664 7.91c.28-.546.686-.966 1.204-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918M25.83 9.1c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM18.932 3.598v9.8h-.994l-.154-1.148c-.602.826-1.414 1.232-2.45 1.232-.672 0-1.26-.14-1.778-.434q-.777-.42-1.218-1.26c-.294-.546-.434-1.204-.434-1.96 0-.714.14-1.344.434-1.904.294-.546.7-.98 1.232-1.288q.777-.462 1.764-.462c.574 0 1.064.112 1.484.322.406.21.728.49.966.854V3.598zm-2.268 8.54q.546-.336.84-.924c.196-.392.294-.854.294-1.358a3.1 3.1 0 0 0-.294-1.372 2.23 2.23 0 0 0-.84-.952 2.3 2.3 0 0 0-1.218-.336c-.714 0-1.288.252-1.722.742s-.644 1.12-.644 1.89c0 .784.21 1.414.644 1.904s1.008.728 1.722.728c.448 0 .854-.098 1.218-.322M10.541 3.71c.14.14.21.322.21.532 0 .224-.07.392-.21.532a.73.73 0 0 1-.532.21.7.7 0 0 1-.532-.21.7.7 0 0 1-.21-.532c0-.21.07-.392.21-.532s.308-.21.532-.21c.21 0 .392.07.532.21M9.435 6.258h1.148v7.14H9.435zM0 3.598h1.288l2.996 8.358 2.982-8.358h1.26l-3.528 9.8h-1.47z"
d="m108.38 6.258 2.198 5.824 2.128-5.824h1.218l-3.29 8.344a6.6 6.6 0 0 1-.448.966c-.14.224-.294.378-.49.476-.196.112-.462.154-.784.154h-1.372v-1.05h1.022c.224 0 .392-.014.504-.07a.5.5 0 0 0 .266-.224c.07-.112.154-.294.266-.546l.364-.854-2.8-7.196zM105.171 6.608q.777.441 1.218 1.26c.294.56.448 1.204.448 1.96 0 .728-.154 1.358-.448 1.904-.294.56-.7.98-1.218 1.288a3.46 3.46 0 0 1-1.764.462c-.588 0-1.078-.098-1.484-.308a2.33 2.33 0 0 1-.966-.868l-.154 1.092h-.994v-9.8h1.148v3.808c.588-.812 1.414-1.232 2.45-1.232.658 0 1.246.154 1.764.434m-.168 5.124c.434-.49.658-1.12.658-1.904 0-.77-.224-1.4-.658-1.89s-1.008-.742-1.708-.742c-.462 0-.868.112-1.232.336s-.63.532-.826.924q-.294.588-.294 1.344 0 .777.294 1.386c.196.406.462.714.826.938s.77.336 1.232.336c.7 0 1.274-.238 1.708-.728M93.881 3.598v9.8h-.994l-.154-1.148c-.602.826-1.414 1.232-2.45 1.232-.672 0-1.26-.14-1.778-.434q-.777-.42-1.218-1.26c-.294-.546-.434-1.204-.434-1.96 0-.714.14-1.344.434-1.904.294-.546.7-.98 1.232-1.288q.777-.462 1.764-.462c.574 0 1.064.112 1.484.322.406.21.728.49.966.854V3.598zm-2.268 8.54q.546-.336.84-.924c.196-.392.294-.854.294-1.358a3.1 3.1 0 0 0-.294-1.372 2.23 2.23 0 0 0-.84-.952 2.3 2.3 0 0 0-1.218-.336c-.714 0-1.288.252-1.722.742s-.644 1.12-.644 1.89c0 .784.21 1.414.644 1.904s1.008.728 1.722.728c.448 0 .854-.098 1.218-.322M79.44 7.91c.28-.546.685-.966 1.203-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918m5.165 1.19c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM78.632 6.258v1.12h-.574c-.686 0-1.176.238-1.47.686-.294.462-.434 1.022-.434 1.694v3.64h-1.148v-7.14H76l.154 1.078c.196-.322.462-.588.798-.784.322-.196.77-.294 1.358-.294zM67.34 7.91c.28-.546.686-.966 1.204-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918m5.166 1.19c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM55.754 6.258h1.204l1.778 5.81 1.876-5.81h1.064l1.778 5.81 1.862-5.81h1.162l-2.38 7.14h-1.26l-1.722-5.306-1.792 5.306-1.26.014zM49.924 13.02a3.16 3.16 0 0 1-1.246-1.288c-.308-.546-.448-1.176-.448-1.904 0-.714.14-1.344.448-1.904.294-.546.714-.98 1.246-1.288q.798-.462 1.848-.462c.686 0 1.302.154 1.834.462s.952.742 1.26 1.288c.294.56.448 1.19.448 1.904 0 .728-.154 1.358-.448 1.904a3.3 3.3 0 0 1-1.26 1.288c-.532.308-1.148.462-1.834.462q-1.05 0-1.848-.462m3.08-.896a2.2 2.2 0 0 0 .84-.938c.196-.392.294-.854.294-1.358s-.098-.952-.294-1.358a2.27 2.27 0 0 0-.84-.938 2.3 2.3 0 0 0-1.232-.336c-.476 0-.882.112-1.246.336s-.63.546-.826.938a3.1 3.1 0 0 0-.294 1.358c0 .504.098.966.294 1.358.196.406.462.714.826.938s.77.336 1.246.336c.462 0 .868-.112 1.232-.336M45.504 6.608q.777.441 1.218 1.26c.294.56.448 1.204.448 1.96 0 .728-.154 1.358-.448 1.904-.294.56-.7.98-1.218 1.288a3.46 3.46 0 0 1-1.764.462c-.588 0-1.078-.098-1.484-.308a2.33 2.33 0 0 1-.966-.868v3.892h-1.148v-9.94h.994l.154 1.148c.588-.812 1.414-1.232 2.45-1.232.658 0 1.246.154 1.764.434m-.168 5.124c.434-.49.658-1.12.658-1.904 0-.77-.224-1.4-.658-1.89s-1.008-.742-1.708-.742c-.462 0-.868.112-1.232.336s-.63.532-.826.924q-.294.588-.294 1.344 0 .777.294 1.386c.196.406.462.714.826.938s.77.336 1.246.336c.462 0 .868-.112 1.232-.336M29.772 13.02a3.16 3.16 0 0 1-1.246-1.288c-.308-.546-.448-1.176-.448-1.904 0-.714.14-1.344.448-1.904.294-.546.714-.98 1.246-1.288q.798-.462 1.848-.462c.686 0 1.302.154 1.834.462s.952.742 1.26 1.288c.294.56.448 1.19.448 1.904 0 .728-.154 1.358-.448 1.904a3.3 3.3 0 0 1-1.26 1.288c-.532.308-1.148.462-1.834.462q-1.05 0-1.848-.462m3.08-.896a2.2 2.2 0 0 0 .84-.938c.196-.392.294-.854.294-1.358s-.098-.952-.294-1.358a2.27 2.27 0 0 0-.84-.938 2.3 2.3 0 0 0-1.232-.336c-.476 0-.882.112-1.246.336s-.63.546-.826.938a3.1 3.1 0 0 0-.294 1.358c0 .504.098.966.294 1.358.196.406.462.714.826.938s.77.336 1.246.336c.462 0 .868-.112 1.232-.336M20.664 7.91c.28-.546.686-.966 1.204-1.274q.756-.462 1.764-.462c.644 0 1.232.14 1.736.406.504.28.896.672 1.19 1.176q.42.777.462 1.806c0 .112-.014.266-.028.49h-5.544v.098c.014.7.224 1.26.644 1.68.406.42.938.63 1.61.63q.756 0 1.302-.378c.364-.252.602-.616.728-1.078h1.162c-.14.728-.49 1.33-1.05 1.792s-1.246.686-2.058.686c-.714 0-1.33-.14-1.862-.448a3.16 3.16 0 0 1-1.246-1.288c-.294-.56-.434-1.19-.434-1.918s.14-1.358.42-1.918M25.83 9.1c-.056-.602-.294-1.078-.686-1.414s-.896-.504-1.498-.504c-.546 0-1.022.182-1.428.532-.42.364-.644.826-.7 1.386zM18.932 3.598v9.8h-.994l-.154-1.148c-.602.826-1.414 1.232-2.45 1.232-.672 0-1.26-.14-1.778-.434q-.777-.42-1.218-1.26c-.294-.546-.434-1.204-.434-1.96 0-.714.14-1.344.434-1.904.294-.546.7-.98 1.232-1.288q.777-.462 1.764-.462c.574 0 1.064.112 1.484.322.406.21.728.49.966.854V3.598zm-2.268 8.54q.546-.336.84-.924c.196-.392.294-.854.294-1.358a3.1 3.1 0 0 0-.294-1.372 2.23 2.23 0 0 0-.84-.952 2.3 2.3 0 0 0-1.218-.336c-.714 0-1.288.252-1.722.742s-.644 1.12-.644 1.89c0 .784.21 1.414.644 1.904s1.008.728 1.722.728c.448 0 .854-.098 1.218-.322M10.541 3.71c.14.14.21.322.21.532 0 .224-.07.392-.21.532a.73.73 0 0 1-.532.21.7.7 0 0 1-.532-.21.7.7 0 0 1-.21-.532c0-.21.07-.392.21-.532s.308-.21.532-.21c.21 0 .392.07.532.21M9.435 6.258h1.148v7.14H9.435zM0 3.598h1.288l2.996 8.358 2.982-8.358h1.26l-3.528 9.8h-1.47z"
opacity=".9"
/>
</g>
Expand Down
30 changes: 23 additions & 7 deletions src/pages/learn/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {FunctionComponent} from 'react'
import {loadHolidayCourses, saleOn} from '@/lib/sale'
import {sanityClient} from '@/utils/sanity-client'
import type {FunctionComponent} from 'react'
import Home from '@/components/pages/home'
import {NextSeo} from 'next-seo'
import find from 'lodash/find'
Expand All @@ -12,11 +12,11 @@ import {getServerState} from 'react-instantsearch'
import TheFeed from '@/components/pages/home/the-feed'
import {renderToString} from 'react-dom/server'

const LearnPage: FunctionComponent<React.PropsWithChildren<any>> = ({
data,
holidayCourses,
searchServerState,
}) => {
const LearnPage: FunctionComponent<{
data: CuratedHomePageDataType
holidayCourses: Record<string, unknown>
searchServerState: unknown
}> = ({data, holidayCourses, searchServerState}) => {
const location = 'curated home landing'
const jumbotron = find(data.sections, {slug: 'jumbotron'})
const ogImage = get(
Expand Down Expand Up @@ -147,18 +147,34 @@ const CuratedHomePageData = z.object({
export type CuratedHomePageDataType = z.infer<typeof CuratedHomePageData>

export async function getStaticProps() {
console.log('Fetching homepage data...')
const data = await sanityClient.fetch(homepageQuery)
console.log('Homepage data fetched:', {
title: data?.title,
sectionCount: data?.sections?.length,
})

const holidayCourses = saleOn ? await loadHolidayCourses() : {}
console.log('Holiday courses loaded:', {
courseCount: Object.keys(holidayCourses).length,
})

const searchServerState = await getServerState(<TheFeed />, {
renderToString,
})

const sanitizedSearchState = JSON.parse(
JSON.stringify(searchServerState, (_, value) =>
value === undefined ? null : value,
),
)
console.log('Search state sanitized')

return {
props: {
holidayCourses,
data,
searchServerState,
searchServerState: sanitizedSearchState,
},
}
}

0 comments on commit dc70eef

Please sign in to comment.