@@ -1080,10 +1080,15 @@ export function renderer(renderer: () => RenderResult): Renderer {
1080
1080
const nextSibling = _wrapperSiblingMap . get ( searchNode ) ;
1081
1081
if ( nextSibling ) {
1082
1082
let domNode = nextSibling . domNode ;
1083
- if ( ( isWNodeWrapper ( nextSibling ) || isVirtualWrapper ( nextSibling ) ) && nextSibling . childDomWrapperId ) {
1084
- const childWrapper = _idToWrapperMap . get ( nextSibling . childDomWrapperId ) ;
1085
- if ( childWrapper ) {
1086
- domNode = childWrapper . domNode ;
1083
+ if ( isWNodeWrapper ( nextSibling ) || isVirtualWrapper ( nextSibling ) ) {
1084
+ if ( ! nextSibling . childDomWrapperId ) {
1085
+ nextSibling . childDomWrapperId = findDomNodeOnParentWrapper ( nextSibling ) ;
1086
+ }
1087
+ if ( nextSibling . childDomWrapperId ) {
1088
+ const childWrapper = _idToWrapperMap . get ( nextSibling . childDomWrapperId ) ;
1089
+ if ( childWrapper && ! isBodyWrapper ( childWrapper ) ) {
1090
+ domNode = childWrapper . domNode ;
1091
+ }
1087
1092
}
1088
1093
}
1089
1094
if ( domNode && domNode . parentNode ) {
@@ -1896,16 +1901,14 @@ export function renderer(renderer: () => RenderResult): Renderer {
1896
1901
return processResult ;
1897
1902
}
1898
1903
1899
- function setDomNodeOnParentWrapper ( id : string ) {
1900
- let wrapper = _idToWrapperMap . get ( id ) ! ;
1901
- let children = [ ...( _idToChildrenWrappers . get ( id ) || [ ] ) ] ;
1904
+ function findDomNodeOnParentWrapper ( wrapper : DNodeWrapper ) : string | undefined {
1905
+ let children = [ ...( _idToChildrenWrappers . get ( wrapper . id ) || [ ] ) ] ;
1902
1906
let child : DNodeWrapper | undefined ;
1903
1907
while ( children . length && ! wrapper . domNode ) {
1904
1908
child = children . shift ( ) ;
1905
1909
if ( child ) {
1906
1910
if ( child . domNode ) {
1907
- wrapper . childDomWrapperId = child . id ;
1908
- break ;
1911
+ return child . id ;
1909
1912
}
1910
1913
let nextChildren = _idToChildrenWrappers . get ( child . id ) ;
1911
1914
if ( nextChildren ) {
@@ -1915,6 +1918,13 @@ export function renderer(renderer: () => RenderResult): Renderer {
1915
1918
}
1916
1919
}
1917
1920
1921
+ function setDomNodeOnParentWrapper ( id : string ) {
1922
+ let wrapper = _idToWrapperMap . get ( id ) ;
1923
+ if ( wrapper ) {
1924
+ wrapper . childDomWrapperId = findDomNodeOnParentWrapper ( wrapper ) ;
1925
+ }
1926
+ }
1927
+
1918
1928
function _createDom ( { next } : CreateDomInstruction ) : ProcessResult {
1919
1929
const parentDomNode = findParentDomNode ( next ) ! ;
1920
1930
const isVirtual = isVirtualWrapper ( next ) ;
0 commit comments