GeezerVison is showing github.com — Removed _debugID field from Fiber - Issue #21558 (#21570) · react/react@0d493dc
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactFunctionComponent-test.js +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -284,10 +284,8 @@ describe('ReactFunctionComponent', () => { | 284 | 284 | }).toErrorDev('Warning: Function components cannot be given refs.'); | 285 | 285 | // Should be deduped (same internal instance, no additional warnings) | 286 | 286 | instance2.forceUpdate(); | 287 | | - // Could not be deduped (different internal instance): | 288 | | - expect(() => | 289 | | - ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />), | 290 | | - ).toErrorDev('Warning: Function components cannot be given refs.'); | | 287 | + // Could not be differentiated (since owner is anonymous and no source location) | | 288 | + ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />); | 291 | 289 |
| 292 | 290 | // When owner doesn't use JSX, but is named, we warn once per owner name | 293 | 291 | class NamedParentNotUsingJSX extends React.Component { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.new.js +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -108,8 +108,6 @@ if (__DEV__) { | 108 | 108 | } | 109 | 109 | } | 110 | 110 |
| 111 | | -let debugCounter = 1; | 112 | | - | 113 | 111 | function FiberNode( | 114 | 112 | tag: WorkTag, | 115 | 113 | pendingProps: mixed, | @@ -178,7 +176,7 @@ function FiberNode( | 178 | 176 |
| 179 | 177 | if (__DEV__) { | 180 | 178 | // This isn't directly used but is handy for debugging internals: | 181 | | - this._debugID = debugCounter++; | | 179 | + | 182 | 180 | this._debugSource = null; | 183 | 181 | this._debugOwner = null; | 184 | 182 | this._debugNeedsRemount = false; | @@ -261,7 +259,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { | 261 | 259 |
| 262 | 260 | if (__DEV__) { | 263 | 261 | // DEV-only fields | 264 | | - workInProgress._debugID = current._debugID; | | 262 | + | 265 | 263 | workInProgress._debugSource = current._debugSource; | 266 | 264 | workInProgress._debugOwner = current._debugOwner; | 267 | 265 | workInProgress._debugHookTypes = current._debugHookTypes; | @@ -809,7 +807,7 @@ export function assignFiberPropertiesInDEV( | 809 | 807 | target.selfBaseDuration = source.selfBaseDuration; | 810 | 808 | target.treeBaseDuration = source.treeBaseDuration; | 811 | 809 | } | 812 | | - target._debugID = source._debugID; | | 810 | + | 813 | 811 | target._debugSource = source._debugSource; | 814 | 812 | target._debugOwner = source._debugOwner; | 815 | 813 | target._debugNeedsRemount = source._debugNeedsRemount; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.old.js +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -108,8 +108,6 @@ if (__DEV__) { | 108 | 108 | } | 109 | 109 | } | 110 | 110 |
| 111 | | -let debugCounter = 1; | 112 | | - | 113 | 111 | function FiberNode( | 114 | 112 | tag: WorkTag, | 115 | 113 | pendingProps: mixed, | @@ -178,7 +176,7 @@ function FiberNode( | 178 | 176 |
| 179 | 177 | if (__DEV__) { | 180 | 178 | // This isn't directly used but is handy for debugging internals: | 181 | | - this._debugID = debugCounter++; | | 179 | + | 182 | 180 | this._debugSource = null; | 183 | 181 | this._debugOwner = null; | 184 | 182 | this._debugNeedsRemount = false; | @@ -261,7 +259,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { | 261 | 259 |
| 262 | 260 | if (__DEV__) { | 263 | 261 | // DEV-only fields | 264 | | - workInProgress._debugID = current._debugID; | | 262 | + | 265 | 263 | workInProgress._debugSource = current._debugSource; | 266 | 264 | workInProgress._debugOwner = current._debugOwner; | 267 | 265 | workInProgress._debugHookTypes = current._debugHookTypes; | @@ -809,7 +807,7 @@ export function assignFiberPropertiesInDEV( | 809 | 807 | target.selfBaseDuration = source.selfBaseDuration; | 810 | 808 | target.treeBaseDuration = source.treeBaseDuration; | 811 | 809 | } | 812 | | - target._debugID = source._debugID; | | 810 | + | 813 | 811 | target._debugSource = source._debugSource; | 814 | 812 | target._debugOwner = source._debugOwner; | 815 | 813 | target._debugNeedsRemount = source._debugNeedsRemount; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.new.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1653,7 +1653,7 @@ function validateFunctionComponentInDev(workInProgress: Fiber, Component: any) { | 1653 | 1653 | info += '\n\nCheck the render method of `' + ownerName + '`.'; | 1654 | 1654 | } | 1655 | 1655 |
| 1656 | | - let warningKey = ownerName || workInProgress._debugID || ''; | | 1656 | + let warningKey = ownerName || ''; | 1657 | 1657 | const debugSource = workInProgress._debugSource; | 1658 | 1658 | if (debugSource) { | 1659 | 1659 | warningKey = debugSource.fileName + ':' + debugSource.lineNumber; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.old.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1653,7 +1653,7 @@ function validateFunctionComponentInDev(workInProgress: Fiber, Component: any) { | 1653 | 1653 | info += '\n\nCheck the render method of `' + ownerName + '`.'; | 1654 | 1654 | } | 1655 | 1655 |
| 1656 | | - let warningKey = ownerName || workInProgress._debugID || ''; | | 1656 | + let warningKey = ownerName || ''; | 1657 | 1657 | const debugSource = workInProgress._debugSource; | 1658 | 1658 | if (debugSource) { | 1659 | 1659 | warningKey = debugSource.fileName + ':' + debugSource.lineNumber; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactInternalTypes.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -178,7 +178,7 @@ export type Fiber = {| | 178 | 178 | // workInProgress : Fiber -> alternate The alternate used for reuse happens | 179 | 179 | // to be the same as work in progress. | 180 | 180 | // __DEV__ only | 181 | | - _debugID?: number, | | 181 | + | 182 | 182 | _debugSource?: Source | null, | 183 | 183 | _debugOwner?: Fiber | null, | 184 | 184 | _debugIsCurrentlyTiming?: boolean, | |
|