forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Supporting hook variable names in devtools extension #115
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
09a588c
Added injectHookVariableNamesFunction into DevTools
saphal1998 11f9d6e
Filled in some Suspense/cache scaffolding
vibhorgupta-gh 8ec51d6
Added scaffolding for utilizing source maps
vibhorgupta-gh 03aaaef
Generating and parsing ASTs to obtain hook variable names
vibhorgupta-gh 0dc4d1b
Adding support for custom hooks and sub hooks
vibhorgupta-gh 1bd801d
Bug fixes
saphal1998 f7206a2
nits: removed comments and stray console logs
vibhorgupta-gh 9873685
fix: frontend render for custom hook variable names
vibhorgupta-gh 5fae37c
Nits:
saphal1998 49ee150
Shallow merge variable names into hooks in InspectedElement
saphal1998 53ca0eb
Refactor code into react-devtools-shared
saphal1998 e1725dd
Update packages/react-devtools-shared/src/__tests__/inspectedElementC…
saphal1998 a06f8d9
fix: snapshots updated for inspectedElementContext-test.js
vibhorgupta-gh ff7b6c3
Added unit tests for injectHookVariableNames
saphal1998 31ce9bc
Added unit tests for injectHookVariableNames
vibhorgupta-gh d082e69
Added snapshot tests for injectHookVariableNames
vibhorgupta-gh 3c08354
wip: e2e test
vibhorgupta-gh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 187 additions & 0 deletions
187
...es/react-devtools-shared/src/__tests__/__snapshots__/injectHookVariableNames-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`injectHookVariableNamesFunction should create hookLog injected with default variable names for no/multiple references: modified hook log 1`] = ` | ||
Array [ | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 42, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 3, | ||
}, | ||
"hookVariableName": "countState", | ||
"id": 0, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": 1, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 35, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 5, | ||
}, | ||
"hookVariableName": "flagState", | ||
"id": 1, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`injectHookVariableNamesFunction should create hookLog injected with variable names for destructured assignment: modified hook log 1`] = ` | ||
Array [ | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 49, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 3, | ||
}, | ||
"hookVariableName": "count", | ||
"id": 0, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": 0, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 41, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 4, | ||
}, | ||
"hookVariableName": "flag", | ||
"id": 1, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": false, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 29, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 5, | ||
}, | ||
"hookVariableName": "ref", | ||
"id": 2, | ||
"isStateEditable": false, | ||
"name": "Ref", | ||
"subHooks": Array [], | ||
"value": undefined, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`injectHookVariableNamesFunction should create hookLog injected with variable names for inline/multi-line member expressions: modified hook log 1`] = ` | ||
Array [ | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 42, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 3, | ||
}, | ||
"hookVariableName": "count", | ||
"id": 0, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": 1, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 35, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 5, | ||
}, | ||
"hookVariableName": "flag", | ||
"id": 1, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": false, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 41, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 8, | ||
}, | ||
"hookVariableName": "tick", | ||
"id": 2, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": 0, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`injectHookVariableNamesFunction should not inject hookLog with variable names for non declarative primitive hooks: modified hook log 1`] = ` | ||
Array [ | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 44, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 3, | ||
}, | ||
"hookVariableName": "flag", | ||
"id": 0, | ||
"isStateEditable": true, | ||
"name": "State", | ||
"subHooks": Array [], | ||
"value": false, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 40, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 4, | ||
}, | ||
"hookVariableName": "inputRef", | ||
"id": 1, | ||
"isStateEditable": false, | ||
"name": "Ref", | ||
"subHooks": Array [], | ||
"value": undefined, | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 17, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 6, | ||
}, | ||
"id": 2, | ||
"isStateEditable": false, | ||
"name": "Effect", | ||
"subHooks": Array [], | ||
"value": [Function], | ||
}, | ||
Object { | ||
"hookSource": Object { | ||
"columnNumber": 17, | ||
"fileName": "example-app.js", | ||
"functionName": "Example", | ||
"lineNumber": 9, | ||
}, | ||
"id": 3, | ||
"isStateEditable": false, | ||
"name": "LayoutEffect", | ||
"subHooks": Array [], | ||
"value": [Function], | ||
}, | ||
] | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
OR