Skip to content

Commit

Permalink
(fix) Fix react hooks exhaustive deps warnings
Browse files Browse the repository at this point in the history
This PR fixes exhaustive deps warnings for React hooks flagged by the React hooks ESLint plugin.
  • Loading branch information
denniskigen committed Nov 21, 2024
1 parent b2bf704 commit c5e257b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// Disabling these rules for now just to keep the diff small. We'll enable them one by one as we go.
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
Expand All @@ -33,7 +31,6 @@
}
],
"import/no-duplicates": "error",
"prefer-const": "off",
"no-console": [
"error",
{
Expand Down Expand Up @@ -70,7 +67,10 @@
}
]
}
]
],
"prefer-const": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
"overrides": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ const PatientQueueHeader: React.FC<PatientQueueHeaderProps> = ({ title, showLoca
}
}
}, [

Check warning on line 61 in packages/esm-service-queues-app/src/patient-queue-header/patient-queue-header.component.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has duplicate dependencies: 'handleQueueLocationChange' and 'userSession?.sessionLocation?.display'. Either omit them or remove the dependency array
queueLocations,
currentQueueLocationName,
currentQueueLocationUuid,
isLoading,
error,
handleQueueLocationChange,
isLoading,
queueLocations,
userSession?.sessionLocation?.display,
userSession?.sessionLocation?.uuid,
handleQueueLocationChange,
userSession?.sessionLocation?.display,
Expand Down

0 comments on commit c5e257b

Please sign in to comment.