Skip to content

Commit 65d16bb

Browse files
committed
Create Error/Task in the top level calls for jsxProdSignatureRunningInDev
To do this we need to break out the jsxDEV implementation into a helper.
1 parent f497a1e commit 65d16bb

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

packages/react/src/jsx/ReactJSXElement.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,16 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
492492
) {
493493
if (__DEV__) {
494494
const isStaticChildren = false;
495-
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self);
495+
return jsxDEVImpl(
496+
type,
497+
config,
498+
maybeKey,
499+
isStaticChildren,
500+
source,
501+
self,
502+
__DEV__ && enableOwnerStacks ? Error('react-stack-top-frame') : undefined,
503+
__DEV__ && enableOwnerStacks ? createTask(getTaskName(type)) : undefined,
504+
);
496505
}
497506
}
498507

@@ -505,7 +514,16 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
505514
) {
506515
if (__DEV__) {
507516
const isStaticChildren = true;
508-
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self);
517+
return jsxDEVImpl(
518+
type,
519+
config,
520+
maybeKey,
521+
isStaticChildren,
522+
source,
523+
self,
524+
__DEV__ && enableOwnerStacks ? Error('react-stack-top-frame') : undefined,
525+
__DEV__ && enableOwnerStacks ? createTask(getTaskName(type)) : undefined,
526+
);
509527
}
510528
}
511529

@@ -518,6 +536,28 @@ const didWarnAboutKeySpread = {};
518536
* @param {string} key
519537
*/
520538
export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
539+
return jsxDEVImpl(
540+
type,
541+
config,
542+
maybeKey,
543+
isStaticChildren,
544+
source,
545+
self,
546+
__DEV__ && enableOwnerStacks ? Error('react-stack-top-frame') : undefined,
547+
__DEV__ && enableOwnerStacks ? createTask(getTaskName(type)) : undefined,
548+
);
549+
}
550+
551+
function jsxDEVImpl(
552+
type,
553+
config,
554+
maybeKey,
555+
isStaticChildren,
556+
source,
557+
self,
558+
debugStack,
559+
debugTask,
560+
) {
521561
if (__DEV__) {
522562
if (!isValidElementType(type)) {
523563
// This is an invalid element type.
@@ -716,8 +756,8 @@ export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
716756
source,
717757
getOwner(),
718758
props,
719-
__DEV__ && enableOwnerStacks ? Error('react-stack-top-frame') : undefined,
720-
__DEV__ && enableOwnerStacks ? createTask(getTaskName(type)) : undefined,
759+
debugStack,
760+
debugTask,
721761
);
722762
}
723763
}

0 commit comments

Comments
 (0)