@@ -413,31 +413,52 @@ class DeltaUpdates extends Base {
413413 allPostMountUpdates = [ ] ;
414414
415415 batch . forEach ( delta => {
416- const postMountUpdates = delta . postMountUpdates || [ ] ;
417-
418- const node = render . DomApiRenderer . createDomTree ( {
419- index : - 1 ,
420- isRoot : true ,
421- parentNode : null , // detached
422- postMountUpdates,
423- vnode : delta . vnode
424- } ) ;
416+ let localPostMountUpdates = delta . postMountUpdates || [ ] ,
417+ node ;
418+
419+ if ( NeoConfig . useDomApiRenderer ) {
420+ node = render . DomApiRenderer . createDomTree ( {
421+ index : - 1 ,
422+ isRoot : true ,
423+ parentNode : null , // detached
424+ postMountUpdates : localPostMountUpdates ,
425+ vnode : delta . vnode
426+ } )
427+ } else {
428+ node = render . StringBasedRenderer . createNode ( { outerHTML : delta . outerHTML } )
429+ }
425430
426431 if ( node ) {
427432 fragment . appendChild ( node ) ;
428- allPostMountUpdates . push ( ...postMountUpdates ) ;
433+ if ( localPostMountUpdates . length > 0 ) {
434+ allPostMountUpdates . push ( ...localPostMountUpdates )
435+ }
429436 } else {
430- console . error ( 'insertNodeBatch: Failed to create node' , delta . vnode ) ;
437+ console . error ( 'insertNodeBatch: Failed to create node' , delta ) ;
431438 }
432439 } ) ;
433440
434441 parentNode . insertBefore ( fragment , siblingRef || null ) ;
435442
436443 // Apply all post-mount updates (e.g. scroll positions) after the batch insertion
437- allPostMountUpdates . forEach ( ( { node, vnode} ) => {
438- if ( vnode . scrollLeft ) { node . scrollLeft = vnode . scrollLeft }
439- if ( vnode . scrollTop ) { node . scrollTop = vnode . scrollTop }
440- } )
444+ if ( allPostMountUpdates . length > 0 ) {
445+ allPostMountUpdates . forEach ( update => {
446+ // DomApiRenderer format: {node, vnode}
447+ if ( update . node ) {
448+ if ( update . vnode . scrollLeft ) { update . node . scrollLeft = update . vnode . scrollLeft }
449+ if ( update . vnode . scrollTop ) { update . node . scrollTop = update . vnode . scrollTop }
450+ }
451+ // StringBasedRenderer format: {id, scrollLeft, scrollTop}
452+ else {
453+ let node = DomAccess . getElement ( update . id ) ;
454+
455+ if ( node ) {
456+ if ( update . scrollLeft ) { node . scrollLeft = update . scrollLeft }
457+ if ( update . scrollTop ) { node . scrollTop = update . scrollTop }
458+ }
459+ }
460+ } )
461+ }
441462 } else {
442463 console . error ( 'insertNodeBatch: Parent not found' , { parentId, index} ) ;
443464 }
@@ -839,7 +860,7 @@ class DeltaUpdates extends Base {
839860 const delta = deltas [ i ] ;
840861
841862 // Batching optimization for sequential insertNode operations
842- if ( NeoConfig . useDomApiRenderer && delta . action === 'insertNode' && i < len - 1 ) {
863+ if ( delta . action === 'insertNode' && i < len - 1 ) {
843864 let j = i + 1 ,
844865 batch = [ delta ] ;
845866
0 commit comments