Skip to content

Commit

Permalink
Revert "feat(peview): add unstable_observeDocument(s) to preview st…
Browse files Browse the repository at this point in the history
…ore"

This reverts commit 72a05a7.
  • Loading branch information
pedrobonamin authored and bjoerge committed Sep 27, 2024
1 parent 58fa498 commit d6d2016
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 125 deletions.
1 change: 0 additions & 1 deletion packages/sanity/src/core/preview/createGlobalListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function createGlobalListener(client: SanityClient) {
includePreviousRevision: false,
includeMutations: false,
visibility: 'query',
effectFormat: 'mendoza',
tag: 'preview.global',
},
)
Expand Down
87 changes: 0 additions & 87 deletions packages/sanity/src/core/preview/createObserveDocument.ts

This file was deleted.

20 changes: 1 addition & 19 deletions packages/sanity/src/core/preview/documentPreviewStore.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {type MutationEvent, type SanityClient, type WelcomeEvent} from '@sanity/client'
import {type PrepareViewOptions, type SanityDocument} from '@sanity/types'
import {combineLatest, type Observable} from 'rxjs'
import {type Observable} from 'rxjs'
import {distinctUntilChanged, filter, map} from 'rxjs/operators'

import {isRecord} from '../util'
import {createPreviewAvailabilityObserver} from './availability'
import {createGlobalListener} from './createGlobalListener'
import {createObserveDocument} from './createObserveDocument'
import {createPathObserver} from './createPathObserver'
import {createPreviewObserver} from './createPreviewObserver'
import {createObservePathsDocumentPair} from './documentPair'
Expand Down Expand Up @@ -57,18 +56,6 @@ export interface DocumentPreviewStore {
id: string,
paths: PreviewPath[],
) => Observable<DraftsModelDocument<T>>
/**
* Observe a complete document with the given ID
* @hidden
* @beta
*/
unstable_observeDocument: (id: string) => Observable<SanityDocument | undefined>
/**
* Observe a list of complete documents with the given IDs
* @hidden
* @beta
*/
unstable_observeDocuments: (ids: string[]) => Observable<(SanityDocument | undefined)[]>
}

/** @internal */
Expand All @@ -92,8 +79,6 @@ export function createDocumentPreviewStore({
map((event) => (event.type === 'welcome' ? {type: 'connected' as const} : event)),
)

const observeDocument = createObserveDocument({client, mutationChannel: globalListener})

const observeFields = createObserveFields({client: versionedClient, invalidationChannel})
const observePaths = createPathObserver({observeFields})

Expand Down Expand Up @@ -125,9 +110,6 @@ export function createDocumentPreviewStore({
observeForPreview,
observeDocumentTypeFromId,

unstable_observeDocument: observeDocument,
unstable_observeDocuments: (ids: string[]) =>
combineLatest(ids.map((id) => observeDocument(id))),
unstable_observeDocumentPairAvailability: observeDocumentPairAvailability,
unstable_observePathsDocumentPair: observePathsDocumentPair,
}
Expand Down
18 changes: 0 additions & 18 deletions packages/sanity/src/core/preview/utils/applyMendozaPatch.ts

This file was deleted.

0 comments on commit d6d2016

Please sign in to comment.