Skip to content

Commit

Permalink
Merge pull request #11 from Q42/fix/allow-parent-pages-as-drafts
Browse files Browse the repository at this point in the history
fix creating page with draft parent
  • Loading branch information
djohalo2 authored Dec 21, 2023
2 parents 7242bb8 + 6ca41ec commit 21e3587
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/PageTreeViewItemActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 21e3587

Please sign in to comment.