-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Update(useNavigationState): removed eslint + deps array from useEffect #8076
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
Conversation
Signed-off-by: Monsef Noubadji <67560520+Monsef-Noubadji@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull Request Overview
This PR removes the ESLint disable comment and dependencies array from a useEffect hook in the useNavigationState hook, changing it from a mount-only effect to one that runs on every render.
- Removes the
// eslint-disable-next-line react-hooks/exhaustive-depscomment - Removes the empty dependencies array
[]from theuseEffecthook
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Monsef Noubadji <67560520+Monsef-Noubadji@users.noreply.github.com>
|
I do believe eslint will complain because of the removed eslint rule. I don't really see the benefit of this PR... |
|
Lighthouse Results
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8076 +/- ##
==========================================
- Coverage 72.82% 72.81% -0.02%
==========================================
Files 96 96
Lines 8328 8327 -1
Branches 214 214
==========================================
- Hits 6065 6063 -2
- Misses 2262 2263 +1
Partials 1 1 ☔ View full report in Codecov by Sentry. |
mikeesto
left a comment
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.
The purpose of this disable next line is because without it we get:
React Hook useEffect has missing dependencies: 'handleScroll', 'id', 'navigationState', and 'ref'. Either include them or remove the dependency array.eslint[react-hooks/exhaustive-deps](https://github.com/facebook/react/issues/14920)
|
Apologies, @Monsef-Noubadji I'm closing this PR as it unfortunately brings no value. Although, appreciate the time you've put in here ;) |
Description
removed eslint + deps array from useEffect
Validation
just removed the deps array from useEffect
Related Issues
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.