mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
* Removed _debugID field from Fiber * Update ReactFunctionComponent-test.js Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
This commit is contained in:
co-authored by
Brian Vaughn
parent
bb1c821556
commit
0d493dcda9
@@ -284,10 +284,8 @@ describe('ReactFunctionComponent', () => {
|
||||
}).toErrorDev('Warning: Function components cannot be given refs.');
|
||||
// Should be deduped (same internal instance, no additional warnings)
|
||||
instance2.forceUpdate();
|
||||
// Could not be deduped (different internal instance):
|
||||
expect(() =>
|
||||
ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />),
|
||||
).toErrorDev('Warning: Function components cannot be given refs.');
|
||||
// Could not be differentiated (since owner is anonymous and no source location)
|
||||
ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />);
|
||||
|
||||
// When owner doesn't use JSX, but is named, we warn once per owner name
|
||||
class NamedParentNotUsingJSX extends React.Component {
|
||||
|
||||
@@ -108,8 +108,6 @@ if (__DEV__) {
|
||||
}
|
||||
}
|
||||
|
||||
let debugCounter = 1;
|
||||
|
||||
function FiberNode(
|
||||
tag: WorkTag,
|
||||
pendingProps: mixed,
|
||||
@@ -178,7 +176,7 @@ function FiberNode(
|
||||
|
||||
if (__DEV__) {
|
||||
// This isn't directly used but is handy for debugging internals:
|
||||
this._debugID = debugCounter++;
|
||||
|
||||
this._debugSource = null;
|
||||
this._debugOwner = null;
|
||||
this._debugNeedsRemount = false;
|
||||
@@ -261,7 +259,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
|
||||
|
||||
if (__DEV__) {
|
||||
// DEV-only fields
|
||||
workInProgress._debugID = current._debugID;
|
||||
|
||||
workInProgress._debugSource = current._debugSource;
|
||||
workInProgress._debugOwner = current._debugOwner;
|
||||
workInProgress._debugHookTypes = current._debugHookTypes;
|
||||
@@ -809,7 +807,7 @@ export function assignFiberPropertiesInDEV(
|
||||
target.selfBaseDuration = source.selfBaseDuration;
|
||||
target.treeBaseDuration = source.treeBaseDuration;
|
||||
}
|
||||
target._debugID = source._debugID;
|
||||
|
||||
target._debugSource = source._debugSource;
|
||||
target._debugOwner = source._debugOwner;
|
||||
target._debugNeedsRemount = source._debugNeedsRemount;
|
||||
|
||||
@@ -108,8 +108,6 @@ if (__DEV__) {
|
||||
}
|
||||
}
|
||||
|
||||
let debugCounter = 1;
|
||||
|
||||
function FiberNode(
|
||||
tag: WorkTag,
|
||||
pendingProps: mixed,
|
||||
@@ -178,7 +176,7 @@ function FiberNode(
|
||||
|
||||
if (__DEV__) {
|
||||
// This isn't directly used but is handy for debugging internals:
|
||||
this._debugID = debugCounter++;
|
||||
|
||||
this._debugSource = null;
|
||||
this._debugOwner = null;
|
||||
this._debugNeedsRemount = false;
|
||||
@@ -261,7 +259,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
|
||||
|
||||
if (__DEV__) {
|
||||
// DEV-only fields
|
||||
workInProgress._debugID = current._debugID;
|
||||
|
||||
workInProgress._debugSource = current._debugSource;
|
||||
workInProgress._debugOwner = current._debugOwner;
|
||||
workInProgress._debugHookTypes = current._debugHookTypes;
|
||||
@@ -809,7 +807,7 @@ export function assignFiberPropertiesInDEV(
|
||||
target.selfBaseDuration = source.selfBaseDuration;
|
||||
target.treeBaseDuration = source.treeBaseDuration;
|
||||
}
|
||||
target._debugID = source._debugID;
|
||||
|
||||
target._debugSource = source._debugSource;
|
||||
target._debugOwner = source._debugOwner;
|
||||
target._debugNeedsRemount = source._debugNeedsRemount;
|
||||
|
||||
@@ -1653,7 +1653,7 @@ function validateFunctionComponentInDev(workInProgress: Fiber, Component: any) {
|
||||
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
||||
}
|
||||
|
||||
let warningKey = ownerName || workInProgress._debugID || '';
|
||||
let warningKey = ownerName || '';
|
||||
const debugSource = workInProgress._debugSource;
|
||||
if (debugSource) {
|
||||
warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
||||
|
||||
@@ -1653,7 +1653,7 @@ function validateFunctionComponentInDev(workInProgress: Fiber, Component: any) {
|
||||
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
||||
}
|
||||
|
||||
let warningKey = ownerName || workInProgress._debugID || '';
|
||||
let warningKey = ownerName || '';
|
||||
const debugSource = workInProgress._debugSource;
|
||||
if (debugSource) {
|
||||
warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ export type Fiber = {|
|
||||
// workInProgress : Fiber -> alternate The alternate used for reuse happens
|
||||
// to be the same as work in progress.
|
||||
// __DEV__ only
|
||||
_debugID?: number,
|
||||
|
||||
_debugSource?: Source | null,
|
||||
_debugOwner?: Fiber | null,
|
||||
_debugIsCurrentlyTiming?: boolean,
|
||||
|
||||
Reference in New Issue
Block a user