From 6d3b8636f4e14a4e4155279353fa06e86fe2b25c Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 24 Aug 2023 21:29:25 +0300 Subject: [PATCH] fix: mutation type with tabs missing previous tabs (#3196) --- src/graphql/schema/buildMutationInputType.ts | 2 +- test/graphql-schema-gen/config.ts | 43 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/graphql/schema/buildMutationInputType.ts b/src/graphql/schema/buildMutationInputType.ts index 464c1334b4..c0ab661987 100644 --- a/src/graphql/schema/buildMutationInputType.ts +++ b/src/graphql/schema/buildMutationInputType.ts @@ -200,7 +200,7 @@ function buildMutationInputType(payload: Payload, name: string, fields: Field[], if (requiresAtLeastOneField) type = new GraphQLNonNull(type); return { - ...inputObjectTypeConfig, + ...acc, [tab.name]: { type }, }; } diff --git a/test/graphql-schema-gen/config.ts b/test/graphql-schema-gen/config.ts index 8e620caadf..05ce147c55 100644 --- a/test/graphql-schema-gen/config.ts +++ b/test/graphql-schema-gen/config.ts @@ -141,5 +141,48 @@ export default buildConfigWithDefaults({ }, ], }, + { + slug: 'collection3', + fields: [ + { + type: 'tabs', + tabs: [ + { + label: 'Tab 1', + fields: [ + { + name: 'descriptiontab1', + type: 'textarea', + }, + ], + }, + { + label: 'Tab 2', + name: 'tab2', + fields: [ + { + type: 'select', + name: 'selecttab2', + options: [ + { value: 'option1', label: 'Option 1' }, + { value: 'option2', label: 'Option 2' }, + ], + }, + ], + }, + { + label: 'Tab3', + name: 'tab3', + fields: [ + { + name: 'acheckbox', + type: 'checkbox', + }, + ], + }, + ], + }, + ], + }, ], });