From cd682a4d79009376d0b3309cbb272b16bc29611d Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 3 Sep 2024 13:09:02 +0530 Subject: [PATCH] fix: handle duplicate modular block --- src/lib/tsgen/factory.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/lib/tsgen/factory.ts b/src/lib/tsgen/factory.ts index 4c06197..650bdc3 100644 --- a/src/lib/tsgen/factory.ts +++ b/src/lib/tsgen/factory.ts @@ -238,6 +238,7 @@ export default function (userOptions: TSGenOptions) { function visit_content_type( contentType: ContentstackTypes.ContentType | ContentstackTypes.GlobalField ) { + modularBlockInterfaces.clear(); const contentTypeInterface = [ options.docgen.interface(contentType.description), define_interface(contentType, options.systemFields), @@ -252,18 +253,6 @@ export default function (userOptions: TSGenOptions) { return [...modularBlockInterfaces, contentTypeInterface].join('\n\n'); } - - function visit_modular_block( - field: ContentstackTypes.Field, - block: ContentstackTypes.Block - ) { - return ( - '{' + - [block.uid + ':', block.reference_to ? name_type(block.reference_to as string) + ';' : '{' + visit_fields(block.schema || []) + '};'].join(' ') + - visit_block_names(field, block) + - '}' - ) - } function type_modular_blocks(field: ContentstackTypes.Field): string { const blockInterfaceName = name_type(field.uid);