eslint: no conditional use calls

Move the calls of the use function outside conditions so that their
calling is consistent no matter what happens.
This commit is contained in:
Thomas Lavocat 2023-08-09 16:58:38 +02:00 committed by Lucas Garfield
parent bf7f22413b
commit 89437c5e23
2 changed files with 5 additions and 5 deletions

View file

@ -17,12 +17,12 @@ const useGetErrorReason = (err) => {
};
const ErrorDetails = ({ status }) => {
const reason = useGetErrorReason(status.error);
if (!status || status.status !== 'failure') {
return <></>;
}
const reason = useGetErrorReason(status.error);
return (
<div className="pf-u-mt-sm">
<p>{reason}</p>

View file

@ -121,6 +121,9 @@ export const ImageBuildStatus = ({
let hasFailedClone;
let status;
const imageStatuses = useSelector((state) =>
selectImageStatusesById(state, image.id)
);
if (
isImagesTableRow &&
(image.imageType === 'aws' || image.imageType === 'ami')
@ -131,9 +134,6 @@ export const ImageBuildStatus = ({
// For instance, the parent and several of its clones may have a success status. But if a single
// clone has a failure status, then the status displayed in the images table row should be
// failure.
const imageStatuses = useSelector((state) =>
selectImageStatusesById(state, image.id)
);
if (!imageStatuses.includes('success')) {
hasFailedClone = false;
} else if (!imageStatuses.includes('failure')) {