diff --git a/packages/sanity/src/core/create/components/StartInCreateBanner.tsx b/packages/sanity/src/core/create/components/StartInCreateBanner.tsx index 54521640f65..9b8dbd93595 100644 --- a/packages/sanity/src/core/create/components/StartInCreateBanner.tsx +++ b/packages/sanity/src/core/create/components/StartInCreateBanner.tsx @@ -55,7 +55,8 @@ export function StartInCreateBanner(props: StartInCreateBannerProps) { function StartInCreateBannerInner(props: StartInCreateBannerProps & {appIdCache: AppIdCache}) { const {studioApp} = useStudioAppIdStore(props.appIdCache) - if (!studioApp) { + // we check documentReady here and not in the top wrapper, to allow the cache code to run while the document is loading + if (!studioApp || !props.documentReady) { return null } return diff --git a/packages/sanity/src/core/create/types.ts b/packages/sanity/src/core/create/types.ts index 83fdcb868ad..acdf9bd76c7 100644 --- a/packages/sanity/src/core/create/types.ts +++ b/packages/sanity/src/core/create/types.ts @@ -38,5 +38,6 @@ export interface StartInCreateBannerProps { documentType: ObjectSchemaType document: SanityDocumentLike isInitialValueLoading: boolean + documentReady: boolean panelPortalElementId: string } diff --git a/packages/sanity/src/structure/panes/document/document-layout/DocumentLayout.tsx b/packages/sanity/src/structure/panes/document/document-layout/DocumentLayout.tsx index acc23139fc3..54654bbf08a 100644 --- a/packages/sanity/src/structure/panes/document/document-layout/DocumentLayout.tsx +++ b/packages/sanity/src/structure/panes/document/document-layout/DocumentLayout.tsx @@ -82,6 +82,7 @@ export function DocumentLayout() { schemaType, value, isInitialValueLoading, + ready, } = useDocumentPane() const {params: paneParams} = usePaneRouter() const {features} = useStructureTool() @@ -259,6 +260,7 @@ export function DocumentLayout() { document={value} documentId={documentId} documentType={schemaType} + documentReady={ready} isInitialValueLoading={!!isInitialValueLoading} panelPortalElementId={DOCUMENT_PANEL_PORTAL_ELEMENT} />