fix: allow to set maxDepth: 0 for join fields, improve join field JSDoc (#10336)

Allows to set `maxDepth: 0` for join fields and improves JSDoc about
`maxDepth`, adds tests to confirm that
https://github.com/payloadcms/payload/issues/10243 is not an issue, but
just happens because the default `maxDepth` is `1`.
This commit is contained in:
Sasha
2025-01-03 21:25:19 +02:00
committed by GitHub
parent c7b3204439
commit ba228dd0f3
5 changed files with 166 additions and 2 deletions

View File

@@ -168,6 +168,45 @@ export default buildConfigWithDefaults({
},
],
},
{
slug: 'depth-joins-1',
fields: [
{
name: 'rel',
type: 'relationship',
relationTo: 'depth-joins-2',
},
{
name: 'joins',
type: 'join',
collection: 'depth-joins-3',
on: 'rel',
maxDepth: 2,
},
],
},
{
slug: 'depth-joins-2',
fields: [
{
name: 'joins',
type: 'join',
collection: 'depth-joins-1',
on: 'rel',
maxDepth: 2,
},
],
},
{
slug: 'depth-joins-3',
fields: [
{
name: 'rel',
type: 'relationship',
relationTo: 'depth-joins-1',
},
],
},
],
localization: {
locales: ['en', 'es'],