fix: prevents child-parents
This commit is contained in:
@@ -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',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 || {},
|
||||
|
||||
Reference in New Issue
Block a user