fix: prevents child-parents

This commit is contained in:
Jacob Fletcher
2022-11-16 11:31:15 -05:00
parent 46eb61d18a
commit 6200a119f9
2 changed files with 13 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ export const seed = async (payload: Payload) => {
},
})
const {id: childID} = await payload.create({
const { id: childID } = await payload.create({
collection: 'pages',
data: {
title: 'Child page',
@@ -36,4 +36,12 @@ export const seed = async (payload: Payload) => {
parent: childID
},
})
await payload.create({
collection: 'pages',
data: {
title: 'Sister page',
slug: 'sister-page',
},
})
}

View File

@@ -6,7 +6,10 @@ const createParentField = (relationTo: string, overrides?: Partial<RelationshipF
relationTo,
type: 'relationship',
maxDepth: 1,
filterOptions: ({id}) => ({id: {not_equals: id}}),
filterOptions: ({ id }) => ({
id: { not_equals: id },
'breadcrumbs.doc': { not_in: [id] },
}),
admin: {
position: 'sidebar',
...overrides?.admin || {},