File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/testing/internal/profile Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -434,13 +434,20 @@ export function profileHook<ReturnValue extends ValidSnapshot, Props>(
434
434
) ;
435
435
}
436
436
437
- function resolveHookOwner ( ) : React . ComponentType | undefined {
437
+ function resolveR18HookOwner ( ) : React . ComponentType | undefined {
438
438
return ( React as any ) . __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
439
439
?. ReactCurrentOwner ?. current ?. elementType ;
440
440
}
441
441
442
+ function resolveR19HookOwner ( ) : React . ComponentType | undefined {
443
+ return (
444
+ React as any
445
+ ) . __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE ?. A ?. getOwner ( )
446
+ . elementType ;
447
+ }
448
+
442
449
export function useTrackRenders ( { name } : { name ?: string } = { } ) {
443
- const component = name || resolveHookOwner ( ) ;
450
+ const component = name || resolveR18HookOwner ( ) || resolveR19HookOwner ( ) ;
444
451
445
452
if ( ! component ) {
446
453
throw new Error (
You can’t perform that action at this time.
0 commit comments