[security_solution] enable react-hooks/exhaustive-deps#68470
[security_solution] enable react-hooks/exhaustive-deps#68470oatkiller merged 5 commits intoelastic:masterfrom
Conversation
* Enable `react-hooks/exhaustive-deps` rule for security_solution * Disable it anywhere that it would catch an issue
| const abortCtrl = new AbortController(); | ||
|
|
||
| async function fetchData(forceReload: boolean = false) { | ||
| async function fetchData() { |
There was a problem hiding this comment.
removing unused parameters
| fetchData(); | ||
| reFetchRules.current = (refreshPrePackagedRule: boolean = false) => { | ||
| fetchData(true); | ||
| fetchData(); |
There was a problem hiding this comment.
removing unused parameters
| filterOptions.filter, | ||
| filterOptions.sortField, | ||
| filterOptions.sortOrder, | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Doing a sort on every render is not generally advisable. Even if it happened to be harmless here, when reading this code I feel the urge to confirm that filterOptions.tags is of a constant size.
Might be worth scheduling work to improve. We could probably just wrap it in a useMemo if nothing else.
| const onSubmit = useCallback(async () => { | ||
| const { isValid, data } = await form.submit(); | ||
| if (isValid) { | ||
| // `postCase`'s type is incorrect, it actually returns a promise |
There was a problem hiding this comment.
Is this comment correct? I think we could update the type.
|
|
||
| const onResizeStop: ResizeCallback = useCallback( | ||
| (e, direction, ref, delta) => { | ||
| (_e, _direction, _ref, delta) => { |
There was a problem hiding this comment.
Tell tsserver/tsc to ignore the fact that these are unused
|
|
||
| /** Invoked when the user clicks the action to delete the selected timelines */ | ||
| const onDeleteSelected: OnDeleteSelected = useCallback(async () => { | ||
| // The type for `deleteTimelines` is incorrect, it returns a Promise |
There was a problem hiding this comment.
Is this comment right? We could probably fix the type.
| endDate, | ||
| skip, | ||
| userPermissions, | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
It might be worth improving this, as sorting something each render could hinder performance.
|
|
||
| useEffect(() => { | ||
| onSelectedGroupsChanged(selectedGroups); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Another instance of sorting in render. Thoughts on these?
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [ | ||
| featureIndex, | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Another sort in render
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Enable `react-hooks/exhaustive-deps` rule for security_solution * Disable it anywhere that it would catch an issue # Conflicts: # x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_entries.tsx
* master: [ML] DFAnalytics results: ensure ml result fields are shown in data grid (elastic#68305) [security_solution] enable react-hooks/exhaustive-deps (elastic#68470) Closes elastic#66867 by adding missing, requried API params (elastic#68465) [Telemetry] collect number of visualization saved in the past 7, 30 and 90 days (elastic#67865) [Logs UI] View in context tweaks (elastic#67777) Kibana developer examples landing page (elastic#67049) Bump decompress package version (elastic#68386) fix elastic#66185 (elastic#66186) Bump pdfmake package version (elastic#68395) Unskip embeddables/adding_children suite (elastic#68111) Add embed mode options in the Share UI (elastic#58435) Adding key to avoid react warning (elastic#68491)
* Enable `react-hooks/exhaustive-deps` rule for security_solution * Disable it anywhere that it would catch an issue # Conflicts: # x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_entries.tsx
|
Pinging @elastic/siem (Team:SIEM) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
react-hooks/exhaustive-depsrule for security_solutionChecklist
Delete any items that are not applicable to this PR.
For maintainers