@@ -60,6 +60,17 @@ function getOwner() {
60
60
return null ;
61
61
}
62
62
63
+ /** @noinline */
64
+ function UnknownOwner ( ) {
65
+ /** @noinline */
66
+ return ( ( ) => Error ( 'react-stack-top-frame' ) ) ( ) ;
67
+ }
68
+ const createFakeCallStack = {
69
+ 'react-stack-bottom-frame' : function ( callStackForError ) {
70
+ return callStackForError ( ) ;
71
+ } ,
72
+ } ;
73
+
63
74
let specialPropKeyWarningShown ;
64
75
let didWarnAboutElementRef ;
65
76
let didWarnAboutOldJSXRuntime ;
@@ -68,15 +79,13 @@ let unknownOwnerDebugTask;
68
79
69
80
if ( __DEV__ ) {
70
81
didWarnAboutElementRef = { } ;
71
- const unknownOwnerElement = {
72
- 'react-stack-bottom-frame' : ( ) => {
73
- return ( function UnknownOwner ( ) {
74
- return jsxDEV ( ( ) => null , { } , null ) ;
75
- } ) ( ) ;
76
- } ,
77
- } [ 'react-stack-bottom-frame' ] ( ) ;
78
- unknownOwnerDebugStack = unknownOwnerElement . _debugStack ;
79
- unknownOwnerDebugTask = unknownOwnerElement . _debugTask ;
82
+
83
+ // We use this technique to trick minifiers to preserve the function name.
84
+ unknownOwnerDebugStack = createFakeCallStack [ 'react-stack-bottom-frame' ] . bind (
85
+ createFakeCallStack ,
86
+ UnknownOwner ,
87
+ ) ( ) ;
88
+ unknownOwnerDebugTask = createTask ( getTaskName ( UnknownOwner ) ) ;
80
89
}
81
90
82
91
function hasValidRef ( config ) {
@@ -388,6 +397,7 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
388
397
if ( __DEV__ ) {
389
398
const isStaticChildren = false ;
390
399
const trackActualOwner =
400
+ __DEV__ &&
391
401
ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
392
402
return jsxDEVImpl (
393
403
type ,
@@ -418,6 +428,7 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
418
428
if ( __DEV__ ) {
419
429
const isStaticChildren = true ;
420
430
const trackActualOwner =
431
+ __DEV__ &&
421
432
ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
422
433
return jsxDEVImpl (
423
434
type ,
@@ -448,6 +459,7 @@ const didWarnAboutKeySpread = {};
448
459
*/
449
460
export function jsxDEV ( type , config , maybeKey , isStaticChildren , source , self ) {
450
461
const trackActualOwner =
462
+ __DEV__ &&
451
463
ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
452
464
return jsxDEVImpl (
453
465
type ,
@@ -731,6 +743,7 @@ export function createElement(type, config, children) {
731
743
}
732
744
}
733
745
const trackActualOwner =
746
+ __DEV__ &&
734
747
ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
735
748
return ReactElement (
736
749
type ,
0 commit comments