fix: cannot define a join field when the target relationship is nested to a second or higher tab (#12041)

Fixes https://github.com/payloadcms/payload/issues/11720
This commit is contained in:
Sasha
2025-04-10 15:36:03 +03:00
committed by GitHub
parent a0fb3353c6
commit 7aa3c5ea6b
4 changed files with 78 additions and 64 deletions

View File

@@ -162,6 +162,12 @@ export const Categories: CollectionConfig = {
isFiltered: { not_equals: true },
},
},
{
name: 'inTab',
type: 'join',
collection: postsSlug,
on: 'tab.category',
},
{
name: 'joinWithError',
type: 'join',

View File

@@ -142,5 +142,34 @@ export const Posts: CollectionConfig = {
},
],
},
{
type: 'tabs',
tabs: [
{
name: 'first',
fields: [
{
type: 'text',
name: 'tabText',
},
],
},
{
name: 'tab',
fields: [
{
type: 'row',
fields: [
{
name: 'category',
type: 'relationship',
relationTo: categoriesSlug,
},
],
},
],
},
],
},
],
}

View File

@@ -113,6 +113,7 @@ export interface Config {
localizedPolymorphic: 'posts';
localizedPolymorphics: 'posts';
filtered: 'posts';
inTab: 'posts';
joinWithError: 'posts';
hiddenPosts: 'hidden-posts';
singulars: 'singular';
@@ -316,6 +317,12 @@ export interface Post {
blockType: 'block';
}[]
| null;
first?: {
tabText?: string | null;
};
tab?: {
category?: (string | null) | Category;
};
updatedAt: string;
createdAt: string;
}
@@ -429,6 +436,11 @@ export interface Category {
hasNextPage?: boolean;
totalDocs?: number;
};
inTab?: {
docs?: (string | Post)[];
hasNextPage?: boolean;
totalDocs?: number;
};
joinWithError?: {
docs?: (string | Post)[];
hasNextPage?: boolean;
@@ -935,6 +947,16 @@ export interface PostsSelect<T extends boolean = true> {
blockName?: T;
};
};
first?:
| T
| {
tabText?: T;
};
tab?:
| T
| {
category?: T;
};
updatedAt?: T;
createdAt?: T;
}
@@ -963,6 +985,7 @@ export interface CategoriesSelect<T extends boolean = true> {
localizedPolymorphics?: T;
singulars?: T;
filtered?: T;
inTab?: T;
joinWithError?: T;
enableErrorOnJoin?: T;
updatedAt?: T;