Skip to content

Commit

Permalink
fix(core): add default values to releases metadata (#8484)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Feb 4, 2025
1 parent 20781b8 commit f401f27
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/sanity/src/core/releases/store/createReleaseStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {listenQuery} from '../../store/_legacy'
import {RELEASE_DOCUMENT_TYPE, RELEASE_DOCUMENTS_PATH} from './constants'
import {createReleaseMetadataAggregator} from './createReleaseMetadataAggregator'
import {releasesReducer, type ReleasesReducerAction, type ReleasesReducerState} from './reducer'
import {type ReleaseDocument, type ReleaseStore} from './types'
import {type ReleaseDocument, type ReleaseStore, type ReleaseType} from './types'

type ActionWrapper = {action: ReleasesReducerAction}
type ResponseWrapper = {response: ReleaseDocument[]}
Expand All @@ -31,6 +31,7 @@ export const SORT_ORDER = 'desc'

const QUERY_FILTER = `_type=="${RELEASE_DOCUMENT_TYPE}" && _id in path("${RELEASE_DOCUMENTS_PATH}.*")`

const DEFAULT_RELEASE_TYPE: ReleaseType = 'undecided'
const QUERY_PROJECTION = `{
_id,
_type,
Expand All @@ -40,12 +41,10 @@ const QUERY_PROJECTION = `{
state,
finalDocumentStates,
publishAt,
metadata {
title,
description,
intendedPublishAt,
releaseType
}
"metadata": coalesce(metadata, {
"title": "",
"releaseType": "${DEFAULT_RELEASE_TYPE}",
}),
}`

// Newest releases first
Expand Down

0 comments on commit f401f27

Please sign in to comment.