@@ -115,6 +115,8 @@ import {
115115  commitHydratedSuspenseInstance , 
116116  beforeRemoveInstance , 
117117  clearContainer , 
118+   prepareScopeUpdate , 
119+   prepareScopeUnmount , 
118120}  from  './ReactFiberHostConfig' ; 
119121import  { 
120122  captureCommitPhaseError , 
@@ -890,7 +892,7 @@ function commitAttachRef(finishedWork: Fiber) {
890892    } 
891893    // Moved outside to ensure DCE works with this flag 
892894    if  ( enableScopeAPI  &&  finishedWork . tag  ===  ScopeComponent )  { 
893-       instanceToUse  =  instance . methods ; 
895+       instanceToUse  =  instance ; 
894896    } 
895897    if  ( typeof  ref  ===  'function' )  { 
896898      ref ( instanceToUse ) ; 
@@ -1065,10 +1067,12 @@ function commitUnmount(
10651067      return ; 
10661068    } 
10671069    case ScopeComponent : { 
1068-       if  ( enableDeprecatedFlareAPI )  { 
1069-         unmountDeprecatedResponderListeners ( current ) ; 
1070-       } 
10711070      if  ( enableScopeAPI )  { 
1071+         if  ( enableDeprecatedFlareAPI )  { 
1072+           unmountDeprecatedResponderListeners ( current ) ; 
1073+         } 
1074+         const  scopeInstance  =  current . stateNode ; 
1075+         prepareScopeUnmount ( scopeInstance ) ; 
10721076        safelyDetachRef ( current ) ; 
10731077      } 
10741078      return ; 
@@ -1721,7 +1725,6 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
17211725    case  ScopeComponent : { 
17221726      if  ( enableScopeAPI )  { 
17231727        const  scopeInstance  =  finishedWork . stateNode ; 
1724-         scopeInstance . fiber  =  finishedWork ; 
17251728        if  ( enableDeprecatedFlareAPI )  { 
17261729          const  newProps  =  finishedWork . memoizedProps ; 
17271730          const  oldProps  =  current  !==  null  ? current . memoizedProps  : newProps ; 
@@ -1731,6 +1734,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
17311734            updateDeprecatedEventListeners ( nextListeners ,  finishedWork ,  null ) ; 
17321735          } 
17331736        } 
1737+         prepareScopeUpdate ( scopeInstance ,  finishedWork ) ; 
17341738        return ; 
17351739      } 
17361740      break ; 
0 commit comments