-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Provide non-standard stack with invalid type warnings #9679
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
Changes from 3 commits
e403f30
579d919
23cd04b
01107b0
5f8eea3
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 |
|---|---|---|
|
|
@@ -402,6 +402,57 @@ var ReactComponentTreeHook = { | |
|
|
||
| getRootIDs, | ||
| getRegisteredIDs: getItemIDs, | ||
|
|
||
| pushNonStandardWarningStack( | ||
| isCreatingElement: boolean, | ||
| currentSource: ?Source, | ||
| ) { | ||
| if (typeof console.stack !== 'function') { | ||
| return; | ||
| } | ||
|
|
||
| var stack = []; | ||
| var currentOwner = ReactCurrentOwner.current; | ||
| var id = currentOwner && currentOwner._debugID; | ||
|
|
||
| try { | ||
| if (isCreatingElement) { | ||
| stack.push({ | ||
| functionName: id ? ReactComponentTreeHook.getDisplayName(id) : null, | ||
| fileName: currentSource ? currentSource.fileName : null, | ||
| lineNumber: currentSource ? currentSource.lineNumber : null, | ||
| }); | ||
| } | ||
|
|
||
| while (id) { | ||
| var element = ReactComponentTreeHook.getElement(id); | ||
| var parentID = ReactComponentTreeHook.getParentID(id); | ||
| var ownerID = ReactComponentTreeHook.getOwnerID(id); | ||
| var ownerName = ownerID | ||
| ? ReactComponentTreeHook.getDisplayName(ownerID) | ||
| : null; | ||
| var source = element && element._source; | ||
| stack.push({ | ||
| functionName: ownerName, | ||
| fileName: source ? source.fileName : null, | ||
| lineNumber: source ? source.lineNumber : null, | ||
| }); | ||
| id = parentID; | ||
| } | ||
| } catch (err) { | ||
| // Internal state is messed up. | ||
| // Stop building the stack (it's just a nice to have). | ||
| } | ||
|
|
||
| console.stack(stack); | ||
|
||
| }, | ||
|
|
||
| popNonStandardWarningStack() { | ||
| if (typeof console.stackEnd !== 'function') { | ||
| return; | ||
| } | ||
| console.stackEnd(); | ||
| }, | ||
| }; | ||
|
|
||
| module.exports = ReactComponentTreeHook; | ||
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.
Let's call this just
name. It could be a class constructor, method, native method, a "message" or whatever else you might call this thing.