Skip to content

Commit

Permalink
feat(sanity): load release document error field
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed Feb 5, 2025
1 parent 4aa4dd5 commit be91a66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/sanity/src/core/releases/store/createReleaseStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const QUERY_PROJECTION = `{
"title": "",
"releaseType": "${DEFAULT_RELEASE_TYPE}",
}),
// Content Lake initially encoded non-error states as {error: {message: ""}}. This projection
// ensures the error field only appears if the document has a non-empty error message.
...select(
length(error.message) > 0 => { error },
{}
),
}`

// Newest releases first
Expand Down
3 changes: 3 additions & 0 deletions packages/sanity/src/core/releases/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export interface ReleaseDocument extends SanityDocument {
_updatedAt: string
_rev: string
state: ReleaseState
error?: {
message: string
}
finalDocumentStates?: ReleaseFinalDocumentState[]
/**
* If defined, it takes precedence over the intendedPublishAt, the state should be 'scheduled'
Expand Down

0 comments on commit be91a66

Please sign in to comment.