Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: content releases #8454

Merged
merged 23 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5227a4f
feat: content releases
bjoerge Jan 30, 2025
6cdd215
fix: resolving dateTime picker bugs with content releases (#8455)
jordanl17 Jan 30, 2025
161a415
fix(presentation): use live content API for loaders (#8429)
stipsan Jan 30, 2025
c8afe90
fix(sanity): remove Actions API override (#8462)
juice49 Jan 31, 2025
b94cb86
feat(sanity): use language strings in `DiscardVersionAction` (#8463)
juice49 Jan 31, 2025
5f40f43
chore(core): removes useObserveDocumentRevisions, it's not used (#8465)
pedrobonamin Jan 31, 2025
4135e6c
fix(presentation): remove explicit check for `r` in perspectives (#8468)
pedrobonamin Jan 31, 2025
4596e9b
feat(sanity): make Content Releases opt-in (#8470)
juice49 Jan 31, 2025
f8d8f56
chore(core): remove unnecessary exports (#8469)
pedrobonamin Feb 3, 2025
af3fede
test(sanity): switch on content releases for test workspace (#8474)
juice49 Feb 3, 2025
553cc2e
feat(sanity): include only necessary fields in release projection (#8…
juice49 Feb 3, 2025
8173f44
chore(sanity): remove defunct `userMetadata` mapping (#8476)
juice49 Feb 3, 2025
820726a
refactor(sanity): remove defunct release reducer actions (#8478)
juice49 Feb 3, 2025
6d6957f
feat(core): only use `vX` client if strictly necessary (#8466)
pedrobonamin Feb 3, 2025
20781b8
feat(structure): edit `liveEdit` documents through the global draft p…
pedrobonamin Feb 3, 2025
f401f27
fix(core): add default values to releases metadata (#8484)
pedrobonamin Feb 4, 2025
5caca94
chore(core): misc fixes to content-releases branch (#8490)
pedrobonamin Feb 4, 2025
945a204
refactor(releases): UI polish (#8492)
mariuslundgard Feb 4, 2025
d9d26f5
fix(comments): make target ref point at published id instead of versi…
bjoerge Feb 4, 2025
d65fc53
feat(core): add responsiveness to overview releases page (#8494)
RitaDias Feb 4, 2025
3144d8b
fix(core): fix padding issue on global dropdown (#8495)
RitaDias Feb 4, 2025
606f948
feat: upsell content releases (#8457)
jordanl17 Feb 4, 2025
1480d54
fix(migrate): update sanityRequestOptions test (#8496)
pedrobonamin Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ const config = {
'sortOrder',
'status',
'group',
'textWeight',
'showChangesBy',
],
},
},
Expand Down
4 changes: 2 additions & 2 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@portabletext/block-tools": "^1.1.4",
"@portabletext/editor": "^1.30.2",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.0.2",
"@sanity/assist": "^3.1.0",
"@sanity/client": "^6.27.2",
"@sanity/color": "^3.0.0",
"@sanity/color-input": "^4.0.1",
Expand All @@ -34,7 +34,7 @@
"@sanity/logos": "^2.1.2",
"@sanity/migrate": "workspace:*",
"@sanity/preview-url-secret": "^2.1.4",
"@sanity/react-loader": "^1.8.3",
"@sanity/react-loader": "^1.10.35",
"@sanity/tsdoc": "1.0.169",
"@sanity/types": "workspace:*",
"@sanity/ui": "^2.11.8",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/preview/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = createClient({
projectId: 'ppsg7ml5',
dataset: 'playground',
useCdn: true,
apiVersion: '2023-02-06',
apiVersion: 'X',
stega: {
enabled: true,
studioUrl: '/presentation',
Expand Down
47 changes: 47 additions & 0 deletions dev/test-studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ const defaultWorkspace = defineConfig({
tasks: {
enabled: true,
},
releases: {
enabled: true,
},
})

export default defineConfig([
Expand Down Expand Up @@ -208,6 +211,9 @@ export default defineConfig([
unstable_tasks: {
enabled: false,
},
releases: {
enabled: true,
},
},
{
name: 'tsdoc',
Expand All @@ -216,6 +222,9 @@ export default defineConfig([
dataset: 'tsdoc-2',
plugins: [sharedSettings()],
basePath: '/tsdoc',
releases: {
enabled: true,
},
},
{
name: 'playground',
Expand All @@ -225,6 +234,14 @@ export default defineConfig([
dataset: 'playground',
plugins: [sharedSettings()],
basePath: '/playground',
beta: {
eventsAPI: {
releases: true,
},
},
releases: {
enabled: true,
},
},
{
name: 'listener-events',
Expand All @@ -234,6 +251,9 @@ export default defineConfig([
dataset: 'data-loss',
plugins: [sharedSettings()],
basePath: '/listener-events',
releases: {
enabled: true,
},
},
{
name: 'playground-partial-indexing',
Expand All @@ -243,6 +263,9 @@ export default defineConfig([
dataset: 'playground-partial-indexing',
plugins: [sharedSettings()],
basePath: '/playground-partial-indexing',
releases: {
enabled: true,
},
},
{
name: 'staging',
Expand All @@ -259,6 +282,9 @@ export default defineConfig([
unstable_tasks: {
enabled: true,
},
releases: {
enabled: true,
},
},
{
name: 'custom-components',
Expand Down Expand Up @@ -293,6 +319,9 @@ export default defineConfig([
toolMenu: CustomToolMenu,
},
},
releases: {
enabled: true,
},
},
{
name: 'google-theme',
Expand All @@ -303,6 +332,9 @@ export default defineConfig([
basePath: '/google',
theme: googleTheme,
icon: GoogleLogo,
releases: {
enabled: true,
},
},
{
name: 'vercel-theme',
Expand All @@ -313,6 +345,9 @@ export default defineConfig([
basePath: '/vercel',
theme: vercelTheme,
icon: VercelLogo,
releases: {
enabled: true,
},
},
{
name: 'tailwind-theme',
Expand All @@ -323,6 +358,9 @@ export default defineConfig([
basePath: '/tailwind',
theme: tailwindTheme,
icon: TailwindLogo,
releases: {
enabled: true,
},
},
{
name: 'ai-assist',
Expand All @@ -331,6 +369,9 @@ export default defineConfig([
dataset: 'test',
plugins: [sharedSettings(), assist()],
basePath: '/ai-assist',
releases: {
enabled: true,
},
},
{
name: 'stega',
Expand All @@ -344,6 +385,9 @@ export default defineConfig([
input: StegaDebugger,
},
},
releases: {
enabled: true,
},
},
{
name: 'presentation',
Expand All @@ -363,5 +407,8 @@ export default defineConfig([
sharedSettings(),
],
basePath: '/presentation',
releases: {
enabled: true,
},
},
]) as WorkspaceOptions[]
40 changes: 40 additions & 0 deletions dev/test-studio/schema/debug/components/CreateDraft.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {Button, Stack, Text} from '@sanity/ui'
import {useCallback, useState} from 'react'
import {getDraftId, useClient} from 'sanity'
import {useDocumentPane} from 'sanity/structure'

export function CreateDraft() {
const {documentId, documentType, value, editState} = useDocumentPane()

const client = useClient({apiVersion: '2025-01-30'})
const [creatingDraft, setCreatingDraft] = useState(false)
const [error, setError] = useState<Error | null>(null)
const createDraft = useCallback(async () => {
try {
setCreatingDraft(true)
await client.createIfNotExists({
...value,
_id: getDraftId(documentId),
_type: documentType,
name: `${value.name} (draft)`,
})
} catch (e) {
setError(e)
} finally {
setCreatingDraft(false)
}
}, [client, documentId, documentType, value])

return (
<Stack space={2}>
<Button
loading={creatingDraft}
onClick={createDraft}
width="fill"
text={'Create Draft'}
disabled={Boolean(editState?.draft) || creatingDraft}
/>
{error && <Text size={0}>{error.message}</Text>}
</Stack>
)
}
13 changes: 13 additions & 0 deletions dev/test-studio/schema/playlist.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {defineType} from '@sanity/types'

import {CreateDraft} from './debug/components/CreateDraft'

export default defineType({
name: 'playlist',
title: 'Playlist',
type: 'document',
// eslint-disable-next-line camelcase
__experimental_formPreviewTitle: false,
liveEdit: true,

fields: [
{
name: 'name',
Expand All @@ -29,5 +32,15 @@ export default defineType({
title: 'Image',
type: 'image',
},
{
name: 'createDraft',
title: 'Create Draft',
type: 'string',
description:
"Clicking on the 'Create Draft' button will create a draft for this live edit document",
components: {
input: CreateDraft,
},
},
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('toFetchOptions', () => {
init: {
headers: {
'Content-Type': 'application/json',
'User-Agent': '@sanity/migrate@3.72.1',
'User-Agent': expect.stringMatching(/^@sanity\/migrate@3\./),
},
method: 'GET',
},
Expand Down
3 changes: 2 additions & 1 deletion packages/@sanity/types/src/reference/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type SanityClient} from '@sanity/client'
import {type ClientPerspective, type SanityClient} from '@sanity/client'

import {type SanityDocument} from '../documents'
import {type Path} from '../paths'
Expand Down Expand Up @@ -30,6 +30,7 @@ export type ReferenceFilterSearchOptions = {
tag?: string
maxFieldDepth?: number
strategy?: SearchStrategy
perspective?: ClientPerspective
}

/** @public */
Expand Down
3 changes: 3 additions & 0 deletions packages/@sanity/types/src/schema/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export interface PrepareViewOptions {

/** @public */
export interface PreviewValue {
_id?: string
_createdAt?: string
_updatedAt?: string
title?: string
subtitle?: string
description?: string
Expand Down
3 changes: 2 additions & 1 deletion packages/@sanity/vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"json5": "^2.2.3",
"lodash": "^4.17.21",
"quick-lru": "^5.1.1",
"react-compiler-runtime": "19.0.0-beta-714736e-20250131"
"react-compiler-runtime": "19.0.0-beta-714736e-20250131",
"react-fast-compare": "^3.2.2"
},
"devDependencies": {
"@repo/package.config": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions packages/@sanity/vision/src/SanityVision.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type Tool, useClient} from 'sanity'
import {type Tool, useClient, usePerspective} from 'sanity'

import {DEFAULT_API_VERSION} from './apiVersions'
import {VisionContainer} from './containers/VisionContainer'
Expand All @@ -11,14 +11,15 @@ interface SanityVisionProps {

function SanityVision(props: SanityVisionProps) {
const client = useClient({apiVersion: '1'})
const perspective = usePerspective()
const config: VisionConfig = {
defaultApiVersion: DEFAULT_API_VERSION,
...props.tool.options,
}

return (
<VisionErrorBoundary>
<VisionContainer client={client} config={config} />
<VisionContainer client={client} config={config} pinnedPerspective={perspective} />
</VisionErrorBoundary>
)
}
Expand Down
Loading
Loading