@@ -72,9 +72,20 @@ function getOwner() {
72
72
let specialPropKeyWarningShown ;
73
73
let didWarnAboutElementRef ;
74
74
let didWarnAboutOldJSXRuntime ;
75
+ let unknownOwnerDebugStack ;
76
+ let unknownOwnerDebugTask ;
75
77
76
78
if ( __DEV__ ) {
77
79
didWarnAboutElementRef = { } ;
80
+ const unknownOwnerElement = {
81
+ 'react-stack-bottom-frame' : ( ) => {
82
+ return ( function UnknownOwner ( ) {
83
+ return jsxDEV ( ( ) => null , { } , null ) ;
84
+ } ) ( ) ;
85
+ } ,
86
+ } [ 'react-stack-bottom-frame' ] ( ) ;
87
+ unknownOwnerDebugStack = unknownOwnerElement . _debugStack ;
88
+ unknownOwnerDebugTask = unknownOwnerElement . _debugTask ;
78
89
}
79
90
80
91
function hasValidRef ( config ) {
@@ -392,16 +403,14 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
392
403
isStaticChildren ,
393
404
source ,
394
405
self ,
395
- // TODO: Reuse a placeholder stack to indicate the deopt.
396
406
__DEV__ &&
397
407
( recentlyCreatedOwnerStacks ++ < ownerStackLimit
398
408
? Error ( 'react-stack-top-frame' )
399
- : null ) ,
400
- // TODO: If task.run is not the bottleneck, reuse a placeholder task to indicate the deop.
409
+ : unknownOwnerDebugStack ) ,
401
410
__DEV__ &&
402
411
( recentlyCreatedDebugTasks ++ < debugTaskLimit
403
412
? createTask ( getTaskName ( type ) )
404
- : null ) ,
413
+ : unknownOwnerDebugTask ) ,
405
414
) ;
406
415
}
407
416
}
@@ -422,16 +431,14 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
422
431
isStaticChildren ,
423
432
source ,
424
433
self ,
425
- // TODO: Reuse a placeholder stack to indicate the deopt.
426
434
__DEV__ &&
427
435
( recentlyCreatedOwnerStacks ++ < ownerStackLimit
428
436
? Error ( 'react-stack-top-frame' )
429
- : null ) ,
430
- // TODO: If task.run is not the bottleneck, reuse a placeholder task to indicate the deop.
437
+ : unknownOwnerDebugStack ) ,
431
438
__DEV__ &&
432
439
( recentlyCreatedDebugTasks ++ < debugTaskLimit
433
440
? createTask ( getTaskName ( type ) )
434
- : null ) ,
441
+ : unknownOwnerDebugTask ) ,
435
442
) ;
436
443
}
437
444
}
@@ -452,16 +459,14 @@ export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
452
459
isStaticChildren ,
453
460
source ,
454
461
self ,
455
- // TODO: Reuse a placeholder stack to indicate the deopt.
456
462
__DEV__ &&
457
463
( recentlyCreatedOwnerStacks ++ < ownerStackLimit
458
464
? Error ( 'react-stack-top-frame' )
459
- : null ) ,
460
- // TODO: If task.run is not the bottleneck, reuse a placeholder task to indicate the deop.
465
+ : unknownOwnerDebugStack ) ,
461
466
__DEV__ &&
462
467
( recentlyCreatedDebugTasks ++ < debugTaskLimit
463
468
? createTask ( getTaskName ( type ) )
464
- : null ) ,
469
+ : unknownOwnerDebugTask ) ,
465
470
) ;
466
471
}
467
472
@@ -736,16 +741,14 @@ export function createElement(type, config, children) {
736
741
undefined ,
737
742
getOwner ( ) ,
738
743
props ,
739
- // TODO: Reuse a placeholder stack to indicate the deopt.
740
744
__DEV__ &&
741
745
( recentlyCreatedOwnerStacks ++ < ownerStackLimit
742
746
? Error ( 'react-stack-top-frame' )
743
- : null ) ,
744
- // TODO: If task.run is not the bottleneck, reuse a placeholder task to indicate the deop.
747
+ : unknownOwnerDebugStack ) ,
745
748
__DEV__ &&
746
749
( recentlyCreatedDebugTasks ++ < debugTaskLimit
747
750
? createTask ( getTaskName ( type ) )
748
- : null ) ,
751
+ : unknownOwnerDebugTask ) ,
749
752
) ;
750
753
}
751
754
0 commit comments