Skip to content
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

[DevTools] Hook names are correctly extracted when parsing nested hook calls #22037

Merged
merged 5 commits into from
Aug 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/react-devtools-extensions/src/astUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function checkNodeLocation(
return false;
}

if (line !== start.line) {
return false;
}
jstejada marked this conversation as resolved.
Show resolved Hide resolved

if (column !== null) {
// Column numbers are represented differently between tools/engines.
// Error.prototype.stack columns are 1-based (like most IDEs) but ASTs are 0-based.
Expand All @@ -52,10 +56,6 @@ function checkNodeLocation(
// For more info see https://github.com/facebook/react/pull/21833#discussion_r666831276
column -= 1;

if (line !== start.line) {
return false;
}

if (
(line === start.line && column < start.column) ||
(line === end.line && column > end.column)
Expand All @@ -64,7 +64,7 @@ function checkNodeLocation(
}
}

return line === start.line;
return true;
}

// Checks whether hookNode is a member of targetHookNode
Expand Down