@@ -3538,40 +3538,48 @@ export function updateFragmentInstanceFiber(
35383538}
35393539
35403540export function commitNewChildToFragmentInstance (
3541- childInstance : InstanceWithFragmentHandles ,
3541+ childInstance : InstanceWithFragmentHandles | Text ,
35423542 fragmentInstance : FragmentInstanceType ,
35433543) : void {
3544+ if ( childInstance . nodeType === TEXT_NODE ) {
3545+ return ;
3546+ }
3547+ const instance : InstanceWithFragmentHandles = ( childInstance : any ) ;
35443548 const eventListeners = fragmentInstance . _eventListeners ;
35453549 if ( eventListeners !== null ) {
35463550 for ( let i = 0 ; i < eventListeners . length ; i ++ ) {
35473551 const { type, listener, optionsOrUseCapture} = eventListeners [ i ] ;
3548- childInstance . addEventListener ( type , listener , optionsOrUseCapture ) ;
3552+ instance . addEventListener ( type , listener , optionsOrUseCapture ) ;
35493553 }
35503554 }
35513555 if ( fragmentInstance . _observers !== null ) {
35523556 fragmentInstance . _observers . forEach ( observer => {
3553- observer . observe ( childInstance ) ;
3557+ observer . observe ( instance ) ;
35543558 } ) ;
35553559 }
35563560 if ( enableFragmentRefsInstanceHandles ) {
3557- addFragmentHandleToInstance ( childInstance , fragmentInstance ) ;
3561+ addFragmentHandleToInstance ( instance , fragmentInstance ) ;
35583562 }
35593563}
35603564
35613565export function deleteChildFromFragmentInstance (
3562- childInstance : InstanceWithFragmentHandles ,
3566+ childInstance : InstanceWithFragmentHandles | Text ,
35633567 fragmentInstance : FragmentInstanceType ,
35643568) : void {
3569+ if ( childInstance . nodeType === TEXT_NODE ) {
3570+ return ;
3571+ }
3572+ const instance : InstanceWithFragmentHandles = ( childInstance : any ) ;
35653573 const eventListeners = fragmentInstance . _eventListeners ;
35663574 if ( eventListeners !== null ) {
35673575 for ( let i = 0 ; i < eventListeners . length ; i ++ ) {
35683576 const { type , listener , optionsOrUseCapture } = eventListeners [ i ] ;
3569- childInstance . removeEventListener ( type , listener , optionsOrUseCapture ) ;
3577+ instance . removeEventListener ( type , listener , optionsOrUseCapture ) ;
35703578 }
35713579 }
35723580 if ( enableFragmentRefsInstanceHandles ) {
3573- if ( childInstance . unstable_reactFragments != null ) {
3574- childInstance . unstable_reactFragments . delete ( fragmentInstance ) ;
3581+ if ( instance . unstable_reactFragments != null ) {
3582+ instance . unstable_reactFragments . delete ( fragmentInstance ) ;
35753583 }
35763584 }
35773585}
0 commit comments