[Fiber] Use Owner/JSX Stack When Appending Stacks to Console (#29206)

This one should be fully behind the `enableOwnerStacks` flag.

Instead of printing the parent Component stack all the way to the root,
this now prints the owner stack of every JSX callsite. It also includes
intermediate callsites between the Component and the JSX call so it has
potentially more frames. Mainly it provides the line number of the JSX
callsite. In terms of the number of components is a subset of the parent
component stack so it's less information in that regard. This is usually
better since it's more focused on components that might affect the
output but if it's contextual based on rendering it's still good to have
parent stack. Therefore, I still use the parent stack when printing DOM
nesting warnings but I plan on switching that format to a diff view
format instead (Next.js already reformats the parent stack like this).

__Follow ups__

- Server Components show up in the owner stack for client logs but logs
done by Server Components don't yet get their owner stack printed as
they're replayed. They're also not yet printed in the server logs of the
RSC server.

- Server Component stack frames are formatted as the server and added to
the end but this might be a different format than the browser. E.g. if
server is running V8 and browser is running JSC or vice versa. Ideally
we can reformat them in terms of the client formatting.

- This doesn't yet update Fizz or DevTools. Those will be follow ups.
Fizz still prints parent stacks in the server side logs. The stacks
added to user space `console.error` calls by DevTools still get the
parent stacks instead.

- It also doesn't yet expose these to user space so there's no way to
get them inside `onCaughtError` for example or inside a custom
`console.error` override.

- In another follow up I'll use `console.createTask` instead and
completely remove these stacks if it's available.

DiffTrain build for commit https://github.com/facebook/react/commit/d6cfa0f295f4c8b366af15fd20c84e27cdd1fab7.
This commit is contained in:
sebmarkbage
2024-05-25 16:03:54 +00:00
parent fc578ff4b0
commit 43adf5dac3
13 changed files with 318 additions and 167 deletions
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8b9b9798442c5728adfabb7cd8ca5f24>>
* @generated SignedSource<<955b120cad9193034a86d0bde3df7d2a>>
*/
'use strict';
@@ -949,6 +949,32 @@ function describeFunctionComponentFrame(fn) {
}
}
// TODO: Consider marking the whole bundle instead of these boundaries.
/** @noinline */
function callComponentInDEV(Component, props, secondArg) {
setIsRendering(true);
var result = Component(props, secondArg);
setIsRendering(false);
return result;
}
/** @noinline */
function callRenderInDEV(instance) {
setIsRendering(true);
var result = instance.render();
setIsRendering(false);
return result;
}
/** @noinline */
function callLazyInitInDEV(lazy) {
var payload = lazy._payload;
var init = lazy._init;
return init(payload);
}
function describeFiber(fiber) {
switch (fiber.tag) {
case HostHoistable:
@@ -1021,8 +1047,6 @@ function getCurrentFiberStackInDev() {
if (current === null) {
return '';
} // Safe because if current fiber exists, we are reconciling,
// and it is guaranteed to be the work-in-progress version.
return getStackByFiberInDevAndProd(current);
}
@@ -5812,9 +5836,9 @@ function warnOnSymbolType(returnFiber, invalidChild) {
}
function resolveLazy(lazyType) {
var payload = lazyType._payload;
var init = lazyType._init;
return init(payload);
{
return callLazyInitInDEV(lazyType);
}
} // This wrapper function exists because I expect to clone the code in each path
// to be able to optimize each path individually by branching early. This needs
// a compiler or we can do it manually. Helpers that don't need this branching
@@ -6086,9 +6110,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return createChild(returnFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return createChild(returnFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
);
}
}
@@ -6172,9 +6200,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return updateSlot(returnFiber, oldFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateSlot(returnFiber, oldFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
@@ -6241,9 +6273,15 @@ function createChildReconciler(shouldTrackSideEffects) {
}
case REACT_LAZY_TYPE:
var payload = newChild._payload;
var init = newChild._init;
return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateFromMap(existingChildren, returnFiber, newIdx, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
if (isArray(newChild) || getIteratorFn(newChild) || enableAsyncIterableChildren ) {
@@ -6317,10 +6355,16 @@ function createChildReconciler(shouldTrackSideEffects) {
break;
case REACT_LAZY_TYPE:
var payload = child._payload;
var init = child._init;
warnOnInvalidKey(init(payload), knownKeys, returnFiber);
break;
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(child);
}
warnOnInvalidKey(resolvedChild, knownKeys, returnFiber);
break;
}
}
}
@@ -7444,7 +7488,7 @@ function renderWithHooks(current, workInProgress, Component, props, secondArg, n
var shouldDoubleRenderDEV = debugRenderPhaseSideEffectsForStrictMode ;
shouldDoubleInvokeUserFnsInHooksDEV = shouldDoubleRenderDEV;
var children = Component(props, secondArg);
var children = callComponentInDEV(Component, props, secondArg) ;
shouldDoubleInvokeUserFnsInHooksDEV = false; // Check if there was a render phase update
if (didScheduleRenderPhaseUpdateDuringThisPass) {
@@ -7584,7 +7628,7 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) {
}
ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV ;
children = Component(props, secondArg);
children = callComponentInDEV(Component, props, secondArg) ;
} while (didScheduleRenderPhaseUpdateDuringThisPass);
return children;
@@ -12300,9 +12344,7 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes);
setIsRendering(false);
}
{
@@ -12769,9 +12811,7 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps,
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
setIsRendering(false);
}
{
@@ -12942,10 +12982,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate,
}
{
setIsRendering(true);
nextChildren = instance.render();
setIsRendering(false);
nextChildren = callRenderInDEV(instance);
}
{
@@ -13106,9 +13143,12 @@ function mountLazyComponent(_current, workInProgress, elementType, renderLanes)
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress);
var props = workInProgress.pendingProps;
var lazyComponent = elementType;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
var Component = init(payload); // Store the unwrapped component in the type.
var Component;
{
Component = callLazyInitInDEV(lazyComponent);
} // Store the unwrapped component in the type.
workInProgress.type = Component;
@@ -14216,9 +14256,7 @@ function updateContextConsumer(current, workInProgress, renderLanes) {
var newChildren;
{
setIsRendering(true);
newChildren = render(newValue);
setIsRendering(false);
newChildren = callComponentInDEV(render, newValue, undefined);
}
{
@@ -14558,7 +14596,9 @@ function beginWork(current, workInProgress, renderLanes) {
{
if (workInProgress._debugNeedsRemount && current !== null) {
// This will restart the begin phase with a new fiber.
return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes));
var copiedFiber = createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes);
return remountFiber(current, workInProgress, copiedFiber);
}
}
@@ -22900,6 +22940,7 @@ function FiberNode(tag, pendingProps, key, mode) {
// This isn't directly used but is handy for debugging internals:
this._debugInfo = null;
this._debugOwner = null;
this._debugNeedsRemount = false;
this._debugHookTypes = null;
@@ -22956,6 +22997,7 @@ function createWorkInProgress(current, pendingProps) {
{
// DEV-only fields
workInProgress._debugOwner = current._debugOwner;
workInProgress._debugHookTypes = current._debugHookTypes;
}
@@ -23463,7 +23505,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}
var ReactVersion = '19.0.0-rc-5a18a922';
var ReactVersion = '19.0.0-rc-999503d6';
/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e0bd67bfbe6ced8b6e410eb3974b80d7>>
* @generated SignedSource<<e2dd990512e58f23e127175cf13f6c55>>
*/
"use strict";
@@ -1723,7 +1723,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -1771,7 +1772,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -1832,11 +1834,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -9300,7 +9303,7 @@ var devToolsConfig$jscomp$inline_1042 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-9c2862e7",
version: "19.0.0-rc-c9fc27c4",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1229 = {
@@ -9331,7 +9334,7 @@ var internals$jscomp$inline_1229 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-9c2862e7"
reconcilerVersion: "19.0.0-rc-c9fc27c4"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1230 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cd5cd2d51aad2dcc6d485f9a9bc90b90>>
* @generated SignedSource<<f18d6d4dff134392d4dfcaa89af16bb0>>
*/
"use strict";
@@ -1811,7 +1811,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -1859,7 +1860,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -1920,11 +1922,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -9943,7 +9946,7 @@ var devToolsConfig$jscomp$inline_1105 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-6cf53e9c",
version: "19.0.0-rc-77c04414",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
@@ -9987,7 +9990,7 @@ var devToolsConfig$jscomp$inline_1105 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-6cf53e9c"
reconcilerVersion: "19.0.0-rc-77c04414"
});
exports._Scheduler = Scheduler;
exports.act = act;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f3f0a5ed50b6bab3eafa955dec73aece>>
* @generated SignedSource<<498b38ab8fbbf44800642c8dc0009e44>>
*/
'use strict';
@@ -970,6 +970,10 @@ var didWarnAboutKeySpread = {};
*/
function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) {
{
if (!isValidElementType(type)) {
// This is an invalid element type.
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d21ecf53697b7bc854cc117890d53e11>>
* @generated SignedSource<<0a367e8c426be018f37ef2a753bebe30>>
*/
'use strict';
@@ -976,24 +976,18 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
function jsxProdSignatureRunningInDevWithDynamicChildren(type, config, maybeKey, source, self) {
{
var isStaticChildren = false;
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self);
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
}
function jsxProdSignatureRunningInDevWithStaticChildren(type, config, maybeKey, source, self) {
{
var isStaticChildren = true;
return jsxDEV(type, config, maybeKey, isStaticChildren, source, self);
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
}
var didWarnAboutKeySpread = {};
/**
* https://github.com/reactjs/rfcs/pull/107
* @param {*} type
* @param {object} props
* @param {string} key
*/
function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) {
{
if (!isValidElementType(type)) {
// This is an invalid element type.
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5b1dc62c6ba34c7e7218ad93ccffc6a0>>
* @generated SignedSource<<43472d2aa5457c3ff87b82ad5ff89a40>>
*/
'use strict';
@@ -24,7 +24,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');
var ReactVersion = '19.0.0-rc-f0094578';
var ReactVersion = '19.0.0-rc-28be327b';
// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
@@ -1244,13 +1244,13 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d
function jsxProdSignatureRunningInDevWithDynamicChildren(type, config, maybeKey, source, self) {
{
var isStaticChildren = false;
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self);
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
}
function jsxProdSignatureRunningInDevWithStaticChildren(type, config, maybeKey, source, self) {
{
var isStaticChildren = true;
return jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self);
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
}
var didWarnAboutKeySpread = {};
@@ -1262,6 +1262,10 @@ var didWarnAboutKeySpread = {};
*/
function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
}
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) {
{
if (!isValidElementType(type)) {
// This is an invalid element type.
@@ -1417,6 +1421,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
* See https://reactjs.org/docs/react-api.html#createelement
*/
function createElement(type, config, children) {
{
if (!isValidElementType(type)) {
@@ -2351,7 +2356,9 @@ function forwardRef(render) {
// This kind of inner function is not used elsewhere so the side effect is okay.
if (!render.name && !render.displayName) {
render.displayName = name;
Object.defineProperty(render, 'name', {
value: name
});
}
}
});
@@ -2391,7 +2398,9 @@ function memo(type, compare) {
// This kind of inner function is not used elsewhere so the side effect is okay.
if (!type.name && !type.displayName) {
type.displayName = name;
Object.defineProperty(type, 'name', {
value: name
});
}
}
});
@@ -1 +1 @@
ee5c19493086fdeb32057e16d1e3414370242307
d6cfa0f295f4c8b366af15fd20c84e27cdd1fab7
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<757728100d8986540b7c4b4ec6d7f99d>>
* @generated SignedSource<<a9b359bc4dbdaf82a81e1f50552b8d9e>>
*/
'use strict';
@@ -5076,6 +5076,32 @@ function describeFunctionComponentFrame(fn) {
}
}
// TODO: Consider marking the whole bundle instead of these boundaries.
/** @noinline */
function callComponentInDEV(Component, props, secondArg) {
setIsRendering(true);
var result = Component(props, secondArg);
setIsRendering(false);
return result;
}
/** @noinline */
function callRenderInDEV(instance) {
setIsRendering(true);
var result = instance.render();
setIsRendering(false);
return result;
}
/** @noinline */
function callLazyInitInDEV(lazy) {
var payload = lazy._payload;
var init = lazy._init;
return init(payload);
}
function describeFiber(fiber) {
switch (fiber.tag) {
case HostHoistable:
@@ -5148,8 +5174,6 @@ function getCurrentFiberStackInDev() {
if (current === null) {
return '';
} // Safe because if current fiber exists, we are reconciling,
// and it is guaranteed to be the work-in-progress version.
return getStackByFiberInDevAndProd(current);
}
@@ -8547,9 +8571,9 @@ function warnOnSymbolType(returnFiber, invalidChild) {
}
function resolveLazy(lazyType) {
var payload = lazyType._payload;
var init = lazyType._init;
return init(payload);
{
return callLazyInitInDEV(lazyType);
}
} // This wrapper function exists because I expect to clone the code in each path
// to be able to optimize each path individually by branching early. This needs
// a compiler or we can do it manually. Helpers that don't need this branching
@@ -8821,9 +8845,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return createChild(returnFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return createChild(returnFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
);
}
}
@@ -8907,9 +8935,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return updateSlot(returnFiber, oldFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateSlot(returnFiber, oldFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
@@ -8976,9 +9008,15 @@ function createChildReconciler(shouldTrackSideEffects) {
}
case REACT_LAZY_TYPE:
var payload = newChild._payload;
var init = newChild._init;
return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateFromMap(existingChildren, returnFiber, newIdx, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
if (isArray(newChild) || getIteratorFn(newChild) || enableAsyncIterableChildren ) {
@@ -9052,10 +9090,16 @@ function createChildReconciler(shouldTrackSideEffects) {
break;
case REACT_LAZY_TYPE:
var payload = child._payload;
var init = child._init;
warnOnInvalidKey(init(payload), knownKeys, returnFiber);
break;
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(child);
}
warnOnInvalidKey(resolvedChild, knownKeys, returnFiber);
break;
}
}
}
@@ -10179,7 +10223,7 @@ function renderWithHooks(current, workInProgress, Component, props, secondArg, n
var shouldDoubleRenderDEV = (workInProgress.mode & StrictLegacyMode) !== NoMode;
shouldDoubleInvokeUserFnsInHooksDEV = shouldDoubleRenderDEV;
var children = Component(props, secondArg);
var children = callComponentInDEV(Component, props, secondArg) ;
shouldDoubleInvokeUserFnsInHooksDEV = false; // Check if there was a render phase update
if (didScheduleRenderPhaseUpdateDuringThisPass) {
@@ -10330,7 +10374,7 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) {
}
ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV ;
children = Component(props, secondArg);
children = callComponentInDEV(Component, props, secondArg) ;
} while (didScheduleRenderPhaseUpdateDuringThisPass);
return children;
@@ -15103,9 +15147,7 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes);
setIsRendering(false);
}
{
@@ -15572,9 +15614,7 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps,
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
setIsRendering(false);
}
{
@@ -15745,20 +15785,17 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate,
}
{
setIsRendering(true);
nextChildren = instance.render();
nextChildren = callRenderInDEV(instance);
if (workInProgress.mode & StrictLegacyMode) {
setIsStrictModeForDevtools(true);
try {
instance.render();
callRenderInDEV(instance);
} finally {
setIsStrictModeForDevtools(false);
}
}
setIsRendering(false);
}
{
@@ -15919,9 +15956,12 @@ function mountLazyComponent(_current, workInProgress, elementType, renderLanes)
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress);
var props = workInProgress.pendingProps;
var lazyComponent = elementType;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
var Component = init(payload); // Store the unwrapped component in the type.
var Component;
{
Component = callLazyInitInDEV(lazyComponent);
} // Store the unwrapped component in the type.
workInProgress.type = Component;
@@ -17029,9 +17069,7 @@ function updateContextConsumer(current, workInProgress, renderLanes) {
var newChildren;
{
setIsRendering(true);
newChildren = render(newValue);
setIsRendering(false);
newChildren = callComponentInDEV(render, newValue, undefined);
}
{
@@ -17371,7 +17409,9 @@ function beginWork(current, workInProgress, renderLanes) {
{
if (workInProgress._debugNeedsRemount && current !== null) {
// This will restart the begin phase with a new fiber.
return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes));
var copiedFiber = createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes);
return remountFiber(current, workInProgress, copiedFiber);
}
}
@@ -25635,6 +25675,7 @@ function FiberNode(tag, pendingProps, key, mode) {
// This isn't directly used but is handy for debugging internals:
this._debugInfo = null;
this._debugOwner = null;
this._debugNeedsRemount = false;
this._debugHookTypes = null;
@@ -25691,6 +25732,7 @@ function createWorkInProgress(current, pendingProps) {
{
// DEV-only fields
workInProgress._debugOwner = current._debugOwner;
workInProgress._debugHookTypes = current._debugHookTypes;
}
@@ -26202,7 +26244,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}
var ReactVersion = '19.0.0-rc-2dfc4dcf';
var ReactVersion = '19.0.0-rc-56feef65';
/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3df16b37cf2b6f509adae77d0539c068>>
* @generated SignedSource<<3689ff78df6b7a85aed1c29948aad1e2>>
*/
"use strict";
@@ -3101,7 +3101,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -3149,7 +3150,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -3210,11 +3212,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -10558,7 +10561,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1119 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-f7d07ad2",
version: "19.0.0-rc-c41f552c",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10601,7 +10604,7 @@ var internals$jscomp$inline_1349 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-f7d07ad2"
reconcilerVersion: "19.0.0-rc-c41f552c"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1350 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<be1f95a9c1c616fcdba783a950a31085>>
* @generated SignedSource<<9e26d0a8949cc8f63aeb19b1d6f092fd>>
*/
"use strict";
@@ -3223,7 +3223,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -3271,7 +3272,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -3332,11 +3334,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -11263,7 +11266,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1199 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-7258f280",
version: "19.0.0-rc-24969d43",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -11319,7 +11322,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-7258f280"
reconcilerVersion: "19.0.0-rc-24969d43"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e91d9280a03e6b476e95222269f99b72>>
* @generated SignedSource<<c501058c642ecaf350c5dee0688f264e>>
*/
'use strict';
@@ -3135,6 +3135,32 @@ function describeFunctionComponentFrame(fn) {
}
}
// TODO: Consider marking the whole bundle instead of these boundaries.
/** @noinline */
function callComponentInDEV(Component, props, secondArg) {
setIsRendering(true);
var result = Component(props, secondArg);
setIsRendering(false);
return result;
}
/** @noinline */
function callRenderInDEV(instance) {
setIsRendering(true);
var result = instance.render();
setIsRendering(false);
return result;
}
/** @noinline */
function callLazyInitInDEV(lazy) {
var payload = lazy._payload;
var init = lazy._init;
return init(payload);
}
function describeFiber(fiber) {
switch (fiber.tag) {
case HostHoistable:
@@ -3207,8 +3233,6 @@ function getCurrentFiberStackInDev() {
if (current === null) {
return '';
} // Safe because if current fiber exists, we are reconciling,
// and it is guaranteed to be the work-in-progress version.
return getStackByFiberInDevAndProd(current);
}
@@ -8724,9 +8748,9 @@ function warnOnSymbolType(returnFiber, invalidChild) {
}
function resolveLazy(lazyType) {
var payload = lazyType._payload;
var init = lazyType._init;
return init(payload);
{
return callLazyInitInDEV(lazyType);
}
} // This wrapper function exists because I expect to clone the code in each path
// to be able to optimize each path individually by branching early. This needs
// a compiler or we can do it manually. Helpers that don't need this branching
@@ -8998,9 +9022,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return createChild(returnFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return createChild(returnFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo) // call merge after init
);
}
}
@@ -9084,9 +9112,13 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
{
var payload = newChild._payload;
var init = newChild._init;
return updateSlot(returnFiber, oldFiber, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateSlot(returnFiber, oldFiber, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
@@ -9153,9 +9185,15 @@ function createChildReconciler(shouldTrackSideEffects) {
}
case REACT_LAZY_TYPE:
var payload = newChild._payload;
var init = newChild._init;
return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(newChild);
}
return updateFromMap(existingChildren, returnFiber, newIdx, resolvedChild, lanes, mergeDebugInfo(debugInfo, newChild._debugInfo));
}
}
if (isArray(newChild) || getIteratorFn(newChild) || enableAsyncIterableChildren ) {
@@ -9229,10 +9267,16 @@ function createChildReconciler(shouldTrackSideEffects) {
break;
case REACT_LAZY_TYPE:
var payload = child._payload;
var init = child._init;
warnOnInvalidKey(init(payload), knownKeys, returnFiber);
break;
{
var resolvedChild;
{
resolvedChild = callLazyInitInDEV(child);
}
warnOnInvalidKey(resolvedChild, knownKeys, returnFiber);
break;
}
}
}
@@ -10356,7 +10400,7 @@ function renderWithHooks(current, workInProgress, Component, props, secondArg, n
var shouldDoubleRenderDEV = (workInProgress.mode & StrictLegacyMode) !== NoMode;
shouldDoubleInvokeUserFnsInHooksDEV = shouldDoubleRenderDEV;
var children = Component(props, secondArg);
var children = callComponentInDEV(Component, props, secondArg) ;
shouldDoubleInvokeUserFnsInHooksDEV = false; // Check if there was a render phase update
if (didScheduleRenderPhaseUpdateDuringThisPass) {
@@ -10507,7 +10551,7 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) {
}
ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV ;
children = Component(props, secondArg);
children = callComponentInDEV(Component, props, secondArg) ;
} while (didScheduleRenderPhaseUpdateDuringThisPass);
return children;
@@ -15280,9 +15324,7 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes);
setIsRendering(false);
}
{
@@ -15749,9 +15791,7 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps,
}
{
setIsRendering(true);
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
setIsRendering(false);
}
{
@@ -15922,20 +15962,17 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate,
}
{
setIsRendering(true);
nextChildren = instance.render();
nextChildren = callRenderInDEV(instance);
if (workInProgress.mode & StrictLegacyMode) {
setIsStrictModeForDevtools(true);
try {
instance.render();
callRenderInDEV(instance);
} finally {
setIsStrictModeForDevtools(false);
}
}
setIsRendering(false);
}
{
@@ -16096,9 +16133,12 @@ function mountLazyComponent(_current, workInProgress, elementType, renderLanes)
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress);
var props = workInProgress.pendingProps;
var lazyComponent = elementType;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
var Component = init(payload); // Store the unwrapped component in the type.
var Component;
{
Component = callLazyInitInDEV(lazyComponent);
} // Store the unwrapped component in the type.
workInProgress.type = Component;
@@ -17206,9 +17246,7 @@ function updateContextConsumer(current, workInProgress, renderLanes) {
var newChildren;
{
setIsRendering(true);
newChildren = render(newValue);
setIsRendering(false);
newChildren = callComponentInDEV(render, newValue, undefined);
}
{
@@ -17548,7 +17586,9 @@ function beginWork(current, workInProgress, renderLanes) {
{
if (workInProgress._debugNeedsRemount && current !== null) {
// This will restart the begin phase with a new fiber.
return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes));
var copiedFiber = createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes);
return remountFiber(current, workInProgress, copiedFiber);
}
}
@@ -25985,6 +26025,7 @@ function FiberNode(tag, pendingProps, key, mode) {
// This isn't directly used but is handy for debugging internals:
this._debugInfo = null;
this._debugOwner = null;
this._debugNeedsRemount = false;
this._debugHookTypes = null;
@@ -26041,6 +26082,7 @@ function createWorkInProgress(current, pendingProps) {
{
// DEV-only fields
workInProgress._debugOwner = current._debugOwner;
workInProgress._debugHookTypes = current._debugHookTypes;
}
@@ -26552,7 +26594,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}
var ReactVersion = '19.0.0-rc-6976a022';
var ReactVersion = '19.0.0-rc-39aeea68';
/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d6d2b1ac8cf114568dfc52f650e8d551>>
* @generated SignedSource<<9ace4387e0d9bb1ccd42fb1b3159b6be>>
*/
"use strict";
@@ -3124,7 +3124,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -3172,7 +3173,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -3233,11 +3235,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -10747,7 +10750,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1187 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-9b393d26",
version: "19.0.0-rc-73edc03e",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10790,7 +10793,7 @@ var internals$jscomp$inline_1434 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-9b393d26"
reconcilerVersion: "19.0.0-rc-73edc03e"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1435 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<be9a4664c4a5b016c4fa96badfe343af>>
* @generated SignedSource<<c509e223f9d7af94afc9e9d4e451b2ae>>
*/
"use strict";
@@ -3246,7 +3246,8 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
return createChild(returnFiber, init(newChild._payload), lanes);
newChild = init(newChild._payload);
return createChild(returnFiber, newChild, lanes);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
return (
@@ -3294,7 +3295,8 @@ function createChildReconciler(shouldTrackSideEffects) {
case REACT_LAZY_TYPE:
return (
(key = newChild._init),
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
(newChild = key(newChild._payload)),
updateSlot(returnFiber, oldFiber, newChild, lanes)
);
}
if (isArrayImpl(newChild) || getIteratorFn(newChild))
@@ -3355,11 +3357,12 @@ function createChildReconciler(shouldTrackSideEffects) {
);
case REACT_LAZY_TYPE:
var init = newChild._init;
newChild = init(newChild._payload);
return updateFromMap(
existingChildren,
returnFiber,
newIdx,
init(newChild._payload),
newChild,
lanes
);
}
@@ -11453,7 +11456,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1267 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-49a80322",
version: "19.0.0-rc-ada09fe8",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -11509,7 +11512,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-49a80322"
reconcilerVersion: "19.0.0-rc-ada09fe8"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {