@@ -160,29 +160,24 @@ function buildFieldSchema(item: any, marketPlacePath: string, parentUid = ''): a
160160 }
161161 }
162162
163- if ( blockSchema . length > 0 ) {
164- blocks . push ( {
165- title : blockRawUid , // Keep original for title
166- uid : blockUid , // Snake case for uid
167- schema : removeDuplicateFields ( blockSchema )
168- } ) ;
169- }
163+ blocks . push ( {
164+ title : blockRawUid , // Keep original for title
165+ uid : blockUid , // Snake case for uid
166+ schema : removeDuplicateFields ( blockSchema )
167+ } ) ;
170168 }
171169
172- if ( blocks . length > 0 ) {
173- return {
174- data_type : "blocks" ,
175- display_name : item ?. display_name || rawUid , // Keep original for display
176- field_metadata : { } ,
177- uid : itemUid , // Snake case uid
178- multiple : true ,
179- mandatory : false ,
180- unique : false ,
181- non_localizable : false ,
182- blocks : removeDuplicateFields ( blocks )
183- } ;
184- }
185- return null ;
170+ return {
171+ data_type : "blocks" ,
172+ display_name : item ?. display_name || rawUid , // Keep original for display
173+ field_metadata : { } ,
174+ uid : itemUid , // Snake case uid
175+ multiple : true ,
176+ mandatory : false ,
177+ unique : false ,
178+ non_localizable : false ,
179+ blocks : removeDuplicateFields ( blocks )
180+ } ;
186181 }
187182
188183 if ( fieldType === 'group' ) {
@@ -316,14 +311,25 @@ export function buildSchemaTree(fields: any[], parentUid = '', parentType = '',
316311
317312 if ( hasChildren ) {
318313 if ( fieldType === 'modular_blocks' ) {
319- // Get modular block children
314+ // Get modular block children (check both current and backup UIDs)
320315 const mbChildren = fields . filter ( f => {
321316 if ( ! f ) return false ;
322317 const fUid = f ?. contentstackFieldUid || '' ;
323318 if ( ! fUid || ! fieldUid ) return false ;
324- return f ?. contentstackFieldType === 'modular_blocks_child' &&
325- fUid . startsWith ( fieldUid + '.' ) &&
326- ! fUid . substring ( fieldUid . length + 1 ) . includes ( '.' ) ;
319+ if ( f ?. contentstackFieldType !== 'modular_blocks_child' ) return false ;
320+
321+ if ( fUid . startsWith ( fieldUid + '.' ) &&
322+ ! fUid . substring ( fieldUid . length + 1 ) . includes ( '.' ) ) {
323+ return true ;
324+ }
325+
326+ if ( oldFieldUid && oldFieldUid !== fieldUid &&
327+ fUid . startsWith ( oldFieldUid + '.' ) &&
328+ ! fUid . substring ( oldFieldUid . length + 1 ) . includes ( '.' ) ) {
329+ return true ;
330+ }
331+
332+ return false ;
327333 } ) ;
328334
329335 result . schema = mbChildren . map ( child => {
0 commit comments