Skip to content

Commit e52b757

Browse files
fix(graphql): pass collectionSlug to nested join fields in tabs, collapsible and group resolvers (#13752)
## Problem GraphQL join fields nested inside tabs and collapsibles return empty results due to missing `collectionSlug` parameter propagation in the tabs and collapsible resolver. ## Root Cause The `tabs` resolver in `fieldToSchemaMap.ts` doesn't pass `collectionSlug` to nested field resolvers, causing polymorphic relationship queries to fail when constructing MongoDB filters. ## Solution - Added `collectionSlug` parameter to tabs resolver function signature - Pass `collectionSlug` to `buildObjectType` for named tabs - Pass `collectionSlug` to `addSubField` for unnamed tabs ## Testing - [x] Verified join fields work correctly in tab-nested scenarios - [x] Tested with multiple collection types - [x] Confirmed no breaking changes to existing functionality Fixes #13345 We have got this running successfully in production and are looking forward for this to get merged so we do not have to patch the core anymore :) --------- Co-authored-by: Alessio Gravili <alessio@gravili.de>
1 parent dbd91bf commit e52b757

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/graphql/src/schema/fieldToSchemaMap.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
248248
}),
249249
}),
250250
collapsible: ({
251+
collectionSlug,
251252
config,
252253
field,
253254
forceNullable,
@@ -261,6 +262,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
261262
const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]
262263
if (addSubField) {
263264
return addSubField({
265+
collectionSlug,
264266
config,
265267
field: subField,
266268
forceNullable,
@@ -298,6 +300,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
298300
}),
299301
}),
300302
group: ({
303+
collectionSlug,
301304
config,
302305
field,
303306
forceNullable,
@@ -348,6 +351,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
348351
const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]
349352
if (addSubField) {
350353
return addSubField({
354+
collectionSlug,
351355
config,
352356
field: subField,
353357
forceNullable,
@@ -840,6 +844,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
840844
}
841845
},
842846
tabs: ({
847+
collectionSlug,
843848
config,
844849
field,
845850
forceNullable,
@@ -857,6 +862,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
857862
if (!graphqlResult.types.groupTypes[interfaceName]) {
858863
const objectType = buildObjectType({
859864
name: interfaceName,
865+
collectionSlug,
860866
config,
861867
fields: tab.fields,
862868
forceNullable,
@@ -894,6 +900,7 @@ export const fieldToSchemaMap: FieldToSchemaMap = {
894900
const addSubField: GenericFieldToSchemaMap = fieldToSchemaMap[subField.type]
895901
if (addSubField) {
896902
return addSubField({
903+
collectionSlug,
897904
config,
898905
field: subField,
899906
forceNullable,

0 commit comments

Comments
 (0)