chore: remove occurrences of the rule of hooks to favour wrapping the components instead

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2021-11-18 10:17:15 +01:00
parent f50966e025
commit f029733d13
4 changed files with 65 additions and 53 deletions
@@ -92,30 +92,33 @@ const generatedColumns: TableColumn[] = [
field: 'fullName',
highlight: true,
render: (row: Partial<Project>) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const routeLink = useRouteRef(buildRouteRef);
if (!row.fullName || !row.lastBuild?.number) {
return (
<>
{row.fullName ||
row.fullDisplayName ||
row.displayName ||
'Unknown'}
</>
);
}
const LinkWrapper: React.FC<{}> = () => {
const routeLink = useRouteRef(buildRouteRef);
if (!row.fullName || !row.lastBuild?.number) {
return (
<>
{row.fullName ||
row.fullDisplayName ||
row.displayName ||
'Unknown'}
</>
);
}
return (
<Link
component={RouterLink}
to={routeLink({
jobFullName: encodeURIComponent(row.fullName),
buildNumber: String(row.lastBuild?.number),
})}
>
{row.fullDisplayName}
</Link>
);
return (
<Link
component={RouterLink}
to={routeLink({
jobFullName: encodeURIComponent(row.fullName),
buildNumber: String(row.lastBuild?.number),
})}
>
{row.fullDisplayName}
</Link>
);
};
return <LinkWrapper />;
},
},
{