From ae63a80e00ddcb6a936ff25a892a8b96bf4da3f9 Mon Sep 17 00:00:00 2001 From: pedrobonamin Date: Fri, 3 Jan 2025 10:36:22 +0100 Subject: [PATCH] fix(core): do not throw if schemaType is not found --- .../tool/detail/useBundleDocuments.ts | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts index c5acbb8d221..bd4465b3284 100644 --- a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts +++ b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts @@ -1,4 +1,9 @@ -import {isValidationErrorMarker, type SanityDocument, type Schema} from '@sanity/types' +import { + isValidationErrorMarker, + type PreviewValue, + type SanityDocument, + type Schema, +} from '@sanity/types' import {uuid} from '@sanity/uuid' import {useMemo} from 'react' import {useObservable} from 'react-rx' @@ -108,7 +113,18 @@ const getActiveReleaseDocumentsObservable = ({ map((document) => { const schemaType = schema.get(document._type) if (!schemaType) { - throw new Error(`Schema type not found for document type ${document._type}`) + console.error( + `Schema type not found for document type ${document._type} (document ID: ${document._id})`, + ) + return of({ + isLoading: false, + values: { + _id: document._id, + title: `Document type "${document._type}" not found`, + _createdAt: document._createdAt, + _updatedAt: document._updatedAt, + } satisfies PreviewValue, + }) } return documentPreviewStore.observeForPreview(document, schemaType).pipe(