@@ -60,6 +60,17 @@ function getOwner() {
6060 return null ;
6161}
6262
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+
6374let specialPropKeyWarningShown ;
6475let didWarnAboutElementRef ;
6576let didWarnAboutOldJSXRuntime ;
@@ -68,15 +79,13 @@ let unknownOwnerDebugTask;
6879
6980if ( __DEV__ ) {
7081 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 ) ) ;
8089}
8190
8291function hasValidRef ( config ) {
@@ -388,6 +397,7 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
388397 if ( __DEV__ ) {
389398 const isStaticChildren = false ;
390399 const trackActualOwner =
400+ __DEV__ &&
391401 ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
392402 return jsxDEVImpl (
393403 type ,
@@ -418,6 +428,7 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
418428 if ( __DEV__ ) {
419429 const isStaticChildren = true ;
420430 const trackActualOwner =
431+ __DEV__ &&
421432 ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
422433 return jsxDEVImpl (
423434 type ,
@@ -448,6 +459,7 @@ const didWarnAboutKeySpread = {};
448459 */
449460export function jsxDEV ( type , config , maybeKey , isStaticChildren , source , self ) {
450461 const trackActualOwner =
462+ __DEV__ &&
451463 ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
452464 return jsxDEVImpl (
453465 type ,
@@ -731,6 +743,7 @@ export function createElement(type, config, children) {
731743 }
732744 }
733745 const trackActualOwner =
746+ __DEV__ &&
734747 ReactSharedInternals . recentlyCreatedOwnerStacks ++ < ownerStackLimit ;
735748 return ReactElement (
736749 type ,
0 commit comments