@@ -77,6 +77,12 @@ import {
7777 getViewTransitionClassName ,
7878} from './ReactFiberViewTransitionComponent' ;
7979
80+ import {
81+ enableProfilerTimer ,
82+ enableComponentPerformanceTrack ,
83+ } from 'shared/ReactFeatureFlags' ;
84+ import { trackAnimatingTask } from './ReactProfilerTimer' ;
85+
8086let didWarnForRootClone = false ;
8187
8288// Used during the apply phase to track whether a parent ViewTransition component
@@ -101,6 +107,7 @@ function applyViewTransitionToClones(
101107 name : string ,
102108 className : ?string ,
103109 clones : Array < Instance > ,
110+ fiber : Fiber ,
104111) : void {
105112 // This gets called when we have found a pair, but after the clone in created. The clone is
106113 // created by the insertion side. If the insertion side if found before the deletion side
@@ -117,6 +124,11 @@ function applyViewTransitionToClones(
117124 className ,
118125 ) ;
119126 }
127+ if ( enableProfilerTimer && enableComponentPerformanceTrack ) {
128+ if ( fiber . _debugTask != null ) {
129+ trackAnimatingTask ( fiber . _debugTask ) ;
130+ }
131+ }
120132}
121133
122134function trackDeletedPairViewTransitions ( deletion : Fiber ) : void {
@@ -171,7 +183,7 @@ function trackDeletedPairViewTransitions(deletion: Fiber): void {
171183 // If we have clones that means that we've already visited this
172184 // ViewTransition boundary before and we can now apply the name
173185 // to those clones. Otherwise, we have to wait until we clone it.
174- applyViewTransitionToClones ( name , className , clones ) ;
186+ applyViewTransitionToClones ( name , className , clones , child ) ;
175187 }
176188 }
177189 if ( pairs . size === 0 ) {
@@ -221,7 +233,7 @@ function trackEnterViewTransitions(deletion: Fiber): void {
221233 // If we have clones that means that we've already visited this
222234 // ViewTransition boundary before and we can now apply the name
223235 // to those clones. Otherwise, we have to wait until we clone it.
224- applyViewTransitionToClones ( name , className , clones ) ;
236+ applyViewTransitionToClones ( name , className , clones , deletion ) ;
225237 }
226238 }
227239 }
@@ -266,7 +278,7 @@ function applyAppearingPairViewTransition(child: Fiber): void {
266278 // If there are no clones at this point, that should mean that there are no
267279 // HostComponent children in this ViewTransition.
268280 if ( clones !== null ) {
269- applyViewTransitionToClones ( name , className , clones ) ;
281+ applyViewTransitionToClones ( name , className , clones , child ) ;
270282 }
271283 }
272284 }
@@ -296,7 +308,7 @@ function applyExitViewTransition(placement: Fiber): void {
296308 // If there are no clones at this point, that should mean that there are no
297309 // HostComponent children in this ViewTransition.
298310 if ( clones !== null ) {
299- applyViewTransitionToClones ( name , className , clones ) ;
311+ applyViewTransitionToClones ( name , className , clones , placement ) ;
300312 }
301313 }
302314}
@@ -314,7 +326,7 @@ function applyNestedViewTransition(child: Fiber): void {
314326 // If there are no clones at this point, that should mean that there are no
315327 // HostComponent children in this ViewTransition.
316328 if ( clones !== null ) {
317- applyViewTransitionToClones ( name , className , clones ) ;
329+ applyViewTransitionToClones ( name , className , clones , child ) ;
318330 }
319331 }
320332}
@@ -346,7 +358,7 @@ function applyUpdateViewTransition(current: Fiber, finishedWork: Fiber): void {
346358 // If there are no clones at this point, that should mean that there are no
347359 // HostComponent children in this ViewTransition.
348360 if ( clones !== null ) {
349- applyViewTransitionToClones ( oldName , className , clones ) ;
361+ applyViewTransitionToClones ( oldName , className , clones , finishedWork ) ;
350362 }
351363}
352364
0 commit comments