From 6ca41ecd78ebc8b81d285e88523ae57398831c6a Mon Sep 17 00:00:00 2001 From: Tobias Stikvoort Date: Wed, 20 Dec 2023 20:18:26 +0100 Subject: [PATCH] fix creating page with draft parent --- src/components/PageTreeViewItemActions.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/PageTreeViewItemActions.tsx b/src/components/PageTreeViewItemActions.tsx index 11c7736..bf77d8c 100644 --- a/src/components/PageTreeViewItemActions.tsx +++ b/src/components/PageTreeViewItemActions.tsx @@ -26,7 +26,15 @@ export const PageTreeViewItemActions = ({ page, onActionOpen, onActionClose }: P const doc = await client.create({ _id: generateDraftId(), _type: type, - parent: config.rootSchemaType === type ? undefined : { _type: 'reference', _ref: page._id }, + parent: + config.rootSchemaType === type + ? undefined + : { + _type: 'reference', + _ref: page._id, + _weak: true, + _strengthenOnPublish: { type: page._type }, + }, ...(language ? { [language]: page[language] } : {}), }); setNewPage(doc);