From c89b026a7a0009f1baec03fa440deddfc5066c0c Mon Sep 17 00:00:00 2001 From: Nina Andal Aarvik Date: Wed, 13 Dec 2023 13:21:36 +0300 Subject: [PATCH] fix(core): simplify code for getting preview paths --- .../src/core/form/studio/inputs/client-adapters/reference.ts | 2 +- .../inputs/crossDatasetReference/datastores/getReferenceInfo.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts b/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts index 50b9d281696..1ea2f8d57b9 100644 --- a/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts +++ b/packages/sanity/src/core/form/studio/inputs/client-adapters/reference.ts @@ -100,7 +100,7 @@ export function getReferenceInfo( } as const) } - const previewPaths = [...(getPreviewPaths(refSchemaType?.preview) || [])] + const previewPaths = getPreviewPaths(refSchemaType?.preview) || [] const draftPreview$ = documentPreviewStore.observePaths(draftRef, previewPaths).pipe( map((result) => diff --git a/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/getReferenceInfo.ts b/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/getReferenceInfo.ts index d2740fb5421..81568991a23 100644 --- a/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/getReferenceInfo.ts +++ b/packages/sanity/src/core/form/studio/inputs/crossDatasetReference/datastores/getReferenceInfo.ts @@ -74,7 +74,7 @@ export function createGetReferenceInfo(context: { (candidate) => candidate.type === resolvedDoc._type, ) - const previewPaths = [...(getPreviewPaths(refSchemaType?.preview) || [])] + const previewPaths = getPreviewPaths(refSchemaType?.preview) || [] const publishedPreview$ = documentPreviewStore .observePaths(doc as Previewable, previewPaths, apiConfig)