-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fiber] Split dev methods within ReactComponentTreeHook #9096
Changes from 2 commits
0e23042
e8f3f92
da9d918
54fef50
1f7cbb6
9a1db49
397fd2b
91de17e
b572e3c
b67a29a
af4d249
f992d54
a159e85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,16 @@ | |
|
||
import type { Fiber } from 'ReactFiber'; | ||
import type { DebugID } from 'ReactInstanceType'; | ||
import type { ComponentTreeHookType } from '../../hooks/ReactComponentTreeHook'; | ||
|
||
const ReactDebugCurrentFrame = {}; | ||
|
||
if (__DEV__) { | ||
var { | ||
const { | ||
getStackAddendumByID, | ||
getStackAddendumByWorkInProgressFiber, | ||
getCurrentStackAddendum, | ||
} = require('ReactComponentTreeHook'); | ||
|
||
}: ComponentTreeHookType = require('ReactComponentTreeHook'); | ||
// Component that is being worked on | ||
ReactDebugCurrentFrame.current = (null : Fiber | DebugID | null); | ||
|
||
|
@@ -38,7 +38,9 @@ if (__DEV__) { | |
if (typeof current === 'number') { | ||
// DebugID from Stack. | ||
const debugID = current; | ||
stack = getStackAddendumByID(debugID); | ||
if (getStackAddendumByID) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to not do this since we already know we're in DEV. See my comment below on potential way to accomplish this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check seems unnecessary, other than for flow, since we're within a |
||
stack = getStackAddendumByID(debugID); | ||
} | ||
} else if (typeof current.tag === 'number') { | ||
// This is a Fiber. | ||
// The stack will only be correct if this is a work in progress | ||
|
@@ -47,7 +49,9 @@ if (__DEV__) { | |
stack = getStackAddendumByWorkInProgressFiber(workInProgress); | ||
} | ||
} else if (element !== null) { | ||
stack = getCurrentStackAddendum(element); | ||
if (getCurrentStackAddendum) { | ||
stack = getCurrentStackAddendum(element); | ||
} | ||
} | ||
return stack; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just say
from 'ReactComponentTreeHook'
?