@samitouri / QOS-React-1 / commits / 7216c0f002

[Flight] Don't assume _debugStack and _owner is defined for prod elements (#33675)

We generally treat these types of fields as optional on ReactDebugInfo and should on ReactElement too. That way we can consume prod payloads from third parties.

Sebastian Markbåge committed Jun 30, 2025 at 16:15 UTC 7216c0f002222cdee3075410f7432d64724640cc
1 file changed +4 -4
packages/react-client/src/ReactFlightClient.js
+4 -4
@@ -928,8 +928,8 @@ function createElement(
928 type: mixed,
929 key: mixed,
930 props: mixed,
931 - owner: null | ReactComponentInfo, // DEV-only
932 - stack: null | ReactStackTrace, // DEV-only
931 + owner: ?ReactComponentInfo, // DEV-only
932 + stack: ?ReactStackTrace, // DEV-only
933 validated: number, // DEV-only
934 ):
935 | React$Element<any>
@@ -942,7 +942,7 @@ function createElement(
942 type,
943 key,
944 props,
945 - _owner: owner,
945 + _owner: owner === undefined ? null : owner,
946 }: any);
947 Object.defineProperty(element, 'ref', {
948 enumerable: false,
@@ -984,7 +984,7 @@ function createElement(
984 configurable: false,
985 enumerable: false,
986 writable: true,
987 - value: stack,
987 + value: stack === undefined ? null : stack,
988 });
989 Object.defineProperty(element, '_debugTask', {
990 configurable: false,