Fix js lints#425
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses JavaScript lint errors by adding ouiaId attributes for better testing and updating the useEffect dependencies to satisfy React hooks rules.
- Added unique
ouiaIdprops to each<Tr>increatePuppetMetricsTable - Included
getLastReportin theuseEffectdependency array
Comments suppressed due to low confidence (1)
webpack/src/Extends/Host/PuppetTab/SubTabs/Reports/components/ConfigStatusCard/index.js:151
- If
getLastReportisn’t memoized (e.g., viauseCallback), adding it to the dependencies will cause the effect to run on every render. Consider wrappinggetLastReportinuseCallbackor ensuring it’s stable to avoid unintended loops.
}, [hostName, reports, getLastReport]);
| useEffect(() => { | ||
| getLastReport(); | ||
| }, [hostName, reports]); | ||
| }, [hostName, reports, getLastReport]); |
There was a problem hiding this comment.
That can lead to side-effects. We tend to ignore that rule if we unsure about following this rule blindly.
There was a problem hiding this comment.
From what I've read it should be fine as long as the dependency is memoized with useCallback (which it is), but I wouldn't mind dropping that
There was a problem hiding this comment.
But yeah, let's play it safe. Dropped
There was a problem hiding this comment.
Thanks, @adamruzicka !
UPD: Agh... I don't have merge rights.
|
And we're green |
|
Thank you @ofedoren for keeping me on the right track |
No description provided.