-
Notifications
You must be signed in to change notification settings - Fork 47k
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
eslint-plugin-react-hooks: allow OptionalMemberExpression in deps (#18819) #18820
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d48edf0:
|
Details of bundled changes.Comparing: 9751935...6398ed5 eslint-plugin-react-hooks
Size changes (experimental) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6398ed5:
|
Details of bundled changes.Comparing: 9751935...6398ed5 eslint-plugin-react-hooks
Size changes (stable) |
Thanks! |
EDIT: reported via #18926 @gaearon I believe this PR caused a regression. consider: const someContext = {
users: Math.random() > 0.5 ? [{name: 'test'}] : undefined,
};
const filteredUsers = useMemo(() => {
return someContext.users?.filter((u) => u.name.startsWith('a'));
}, [someContext.users]); New version of hook now tells us the dep should be |
Summary
Fixes issue #18819
Test Plan
Added test case, and verified the fix works in my own VS Code instance.