Skip to content

Conversation

@kenjonespizza
Copy link
Collaborator

Description

Made the coverImage field optional in the Post schema.

What to review

  • Sanity schema change in studio/src/schemaTypes/documents/post.ts - removed required validation
  • Generated type updates in frontend/sanity.types.ts - coverImage now typed as optional (coverImage?: {...} | null)
  • Frontend already handles missing images correctly with conditional rendering

Testing

Verified that:

  • Posts can be created without a cover image in Sanity Studio
  • Frontend safely handles missing cover images with null checks (post?.coverImage && <CoverImage ...>)
  • TypeScript types correctly reflect optional field
  • No runtime errors when rendering posts without images

@kenjonespizza kenjonespizza requested a review from a team as a code owner December 4, 2025 22:41
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
template-nextjs-clean Ready Ready Preview Comment Dec 4, 2025 10:41pm

@kenjonespizza kenjonespizza requested a review from Copilot December 4, 2025 22:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the coverImage field optional in the Post schema, removing the required validation from Sanity Studio and updating generated TypeScript types accordingly. The frontend already handles missing cover images with conditional rendering, so no frontend code changes were needed.

Key Changes:

  • Removed required validation from coverImage field in Post schema
  • Updated TypeScript types to reflect optional coverImage field (coverImage?: {...} | null)

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
studio/src/schemaTypes/documents/post.ts Removed required validation from coverImage field
studio/schema.json Updated schema definition to mark coverImage as optional and reordered type definitions
frontend/sanity.types.ts Updated generated types to reflect optional coverImage field and reordered type definitions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kenjonespizza kenjonespizza requested a review from kmelve December 4, 2025 22:44
Copy link
Member

@kmelve kmelve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kenjonespizza kenjonespizza merged commit 2bdc352 into main Dec 4, 2025
6 checks passed
@kenjonespizza kenjonespizza deleted the feature/change-cover-image-to-optional branch December 4, 2025 23:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants