Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Espen Hovlandsdal <espen@hovlandsdal.com>
  • Loading branch information
bjoerge and rexxars committed Aug 19, 2024
1 parent 3bee7b4 commit 3c8cba7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/sanity/src/core/preview/createPathObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ function normalizePaths(path: (FieldName | PreviewPath)[]): PreviewPath[] {
/**
* Creates a function that allows observing nested paths on a document.
* If the path includes a reference, the reference will be "followed", allowing for selecting paths within the referenced document.
* @param options - Options - Requires a function that can observe fields on a document
* */
* @param options - Requires a function that can observe fields on a document
* @internal
*/
export function createPathObserver(options: {observeFields: ObserveFieldsFn}) {
const {observeFields} = options

Expand Down
5 changes: 4 additions & 1 deletion packages/sanity/src/core/preview/createPreviewObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ function isReference(value: unknown): value is {_ref: string} {
return isPlainObject(value)
}

// Takes a value and its type and prepares a snapshot for it that can be passed to a preview component
/**
* Takes a value and its type and prepares a snapshot for it that can be passed to a preview component
* @internal
*/
export function createPreviewObserver(context: {
observeDocumentTypeFromId: ObserveDocumentTypeFromIdFn
observePaths: ObservePathsFn
Expand Down
1 change: 1 addition & 0 deletions packages/sanity/src/core/preview/observeFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type Cache = {
* Creates a function that allows observing individual fields on a document.
* It will automatically debounce and batch requests, and maintain an in-memory cache of the latest field values
* @param options - Options to use when creating the observer
* @internal
*/
export function createObserveFields(options: {
client: SanityClient
Expand Down

0 comments on commit 3c8cba7

Please sign in to comment.