Skip to content

Commit 1dc3bde

Browse files
authored
Remove unused arguments from ReactElement (#34174)
After various feature flag removals recently, these arguments became unused and can be deleted.
1 parent de06211 commit 1dc3bde

File tree

1 file changed

+13
-71
lines changed

1 file changed

+13
-71
lines changed

packages/react/src/jsx/ReactJSXElement.js

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -156,30 +156,9 @@ function elementRefGetterWithDeprecationWarning() {
156156
* will not work. Instead test $$typeof field against Symbol.for('react.transitional.element') to check
157157
* if something is a React Element.
158158
*
159-
* @param {*} type
160-
* @param {*} props
161-
* @param {*} key
162-
* @param {string|object} ref
163-
* @param {*} owner
164-
* @param {*} self A *temporary* helper to detect places where `this` is
165-
* different from the `owner` when React.createElement is called, so that we
166-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
167-
* functions, and as long as `this` and owner are the same, there will be no
168-
* change in behavior.
169-
* @param {*} source An annotation object (added by a transpiler or otherwise)
170-
* indicating filename, line number, and/or other information.
171159
* @internal
172160
*/
173-
function ReactElement(
174-
type,
175-
key,
176-
self,
177-
source,
178-
owner,
179-
props,
180-
debugStack,
181-
debugTask,
182-
) {
161+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
183162
// Ignore whatever was passed as the ref argument and treat `props.ref` as
184163
// the source of truth. The only thing we use this for is `element.ref`,
185164
// which will log a deprecation warning on access. In the next release, we
@@ -348,16 +327,7 @@ export function jsxProd(type, config, maybeKey) {
348327
}
349328
}
350329

351-
return ReactElement(
352-
type,
353-
key,
354-
undefined,
355-
undefined,
356-
getOwner(),
357-
props,
358-
undefined,
359-
undefined,
360-
);
330+
return ReactElement(type, key, props, getOwner(), undefined, undefined);
361331
}
362332

363333
// While `jsxDEV` should never be called when running in production, we do
@@ -376,8 +346,6 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
376346
type,
377347
config,
378348
maybeKey,
379-
source,
380-
self,
381349
) {
382350
if (__DEV__) {
383351
const isStaticChildren = false;
@@ -389,8 +357,6 @@ export function jsxProdSignatureRunningInDevWithDynamicChildren(
389357
config,
390358
maybeKey,
391359
isStaticChildren,
392-
source,
393-
self,
394360
__DEV__ &&
395361
(trackActualOwner
396362
? Error('react-stack-top-frame')
@@ -407,8 +373,6 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
407373
type,
408374
config,
409375
maybeKey,
410-
source,
411-
self,
412376
) {
413377
if (__DEV__) {
414378
const isStaticChildren = true;
@@ -420,8 +384,6 @@ export function jsxProdSignatureRunningInDevWithStaticChildren(
420384
config,
421385
maybeKey,
422386
isStaticChildren,
423-
source,
424-
self,
425387
__DEV__ &&
426388
(trackActualOwner
427389
? Error('react-stack-top-frame')
@@ -442,7 +404,7 @@ const didWarnAboutKeySpread = {};
442404
* @param {object} props
443405
* @param {string} key
444406
*/
445-
export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
407+
export function jsxDEV(type, config, maybeKey, isStaticChildren) {
446408
const trackActualOwner =
447409
__DEV__ &&
448410
ReactSharedInternals.recentlyCreatedOwnerStacks++ < ownerStackLimit;
@@ -451,8 +413,6 @@ export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
451413
config,
452414
maybeKey,
453415
isStaticChildren,
454-
source,
455-
self,
456416
__DEV__ &&
457417
(trackActualOwner
458418
? Error('react-stack-top-frame')
@@ -469,8 +429,6 @@ function jsxDEVImpl(
469429
config,
470430
maybeKey,
471431
isStaticChildren,
472-
source,
473-
self,
474432
debugStack,
475433
debugTask,
476434
) {
@@ -491,7 +449,7 @@ function jsxDEVImpl(
491449
if (isStaticChildren) {
492450
if (isArray(children)) {
493451
for (let i = 0; i < children.length; i++) {
494-
validateChildKeys(children[i], type);
452+
validateChildKeys(children[i]);
495453
}
496454

497455
if (Object.freeze) {
@@ -505,7 +463,7 @@ function jsxDEVImpl(
505463
);
506464
}
507465
} else {
508-
validateChildKeys(children, type);
466+
validateChildKeys(children);
509467
}
510468
}
511469

@@ -591,16 +549,7 @@ function jsxDEVImpl(
591549
defineKeyPropWarningGetter(props, displayName);
592550
}
593551

594-
return ReactElement(
595-
type,
596-
key,
597-
self,
598-
source,
599-
getOwner(),
600-
props,
601-
debugStack,
602-
debugTask,
603-
);
552+
return ReactElement(type, key, props, getOwner(), debugStack, debugTask);
604553
}
605554
}
606555

@@ -620,7 +569,7 @@ export function createElement(type, config, children) {
620569
// prod. (Rendering will throw with a helpful message and as soon as the
621570
// type is fixed, the key warnings will appear.)
622571
for (let i = 2; i < arguments.length; i++) {
623-
validateChildKeys(arguments[i], type);
572+
validateChildKeys(arguments[i]);
624573
}
625574

626575
// Unlike the jsx() runtime, createElement() doesn't warn about key spread.
@@ -721,10 +670,8 @@ export function createElement(type, config, children) {
721670
return ReactElement(
722671
type,
723672
key,
724-
undefined,
725-
undefined,
726-
getOwner(),
727673
props,
674+
getOwner(),
728675
__DEV__ &&
729676
(trackActualOwner
730677
? Error('react-stack-top-frame')
@@ -740,10 +687,8 @@ export function cloneAndReplaceKey(oldElement, newKey) {
740687
const clonedElement = ReactElement(
741688
oldElement.type,
742689
newKey,
743-
undefined,
744-
undefined,
745-
!__DEV__ ? undefined : oldElement._owner,
746690
oldElement.props,
691+
!__DEV__ ? undefined : oldElement._owner,
747692
__DEV__ && oldElement._debugStack,
748693
__DEV__ && oldElement._debugTask,
749694
);
@@ -829,16 +774,14 @@ export function cloneElement(element, config, children) {
829774
const clonedElement = ReactElement(
830775
element.type,
831776
key,
832-
undefined,
833-
undefined,
834-
owner,
835777
props,
778+
owner,
836779
__DEV__ && element._debugStack,
837780
__DEV__ && element._debugTask,
838781
);
839782

840783
for (let i = 2; i < arguments.length; i++) {
841-
validateChildKeys(arguments[i], clonedElement.type);
784+
validateChildKeys(arguments[i]);
842785
}
843786

844787
return clonedElement;
@@ -853,10 +796,9 @@ export function cloneElement(element, config, children) {
853796
* @param {ReactNode} node Statically passed child of any type.
854797
* @param {*} parentType node's parent's type.
855798
*/
856-
function validateChildKeys(node, parentType) {
799+
function validateChildKeys(node) {
857800
if (__DEV__) {
858-
// With owner stacks is, no warnings happens. All we do is
859-
// mark elements as being in a valid static child position so they
801+
// Mark elements as being in a valid static child position so they
860802
// don't need keys.
861803
if (isValidElement(node)) {
862804
if (node._store) {

0 commit comments

Comments
 (0)