app: useEffect warning fixes
This commit addresses warnings related to the react-hooks/exhaustive-deps rule. It resolves these warnings by adding the missing dependencies to the useEffect hook.
This commit is contained in:
parent
b6ff3323d5
commit
a0a08ff5e8
7 changed files with 21 additions and 10 deletions
|
|
@ -14,7 +14,7 @@ const App = (props) => {
|
|||
useEffect(() => {
|
||||
updateDocumentTitle('Image Builder | Red Hat Insights');
|
||||
hideGlobalFilter();
|
||||
}, []);
|
||||
}, [hideGlobalFilter, updateDocumentTitle]);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,12 @@ export const AWSSourcesSelect = ({
|
|||
useEffect(() => {
|
||||
if (isFetchingDetails || !isSuccessDetails) return;
|
||||
change('aws-associated-account-id', sourceDetails?.aws?.account_id);
|
||||
}, [isFetchingDetails, isSuccessDetails]);
|
||||
}, [
|
||||
isFetchingDetails,
|
||||
isSuccessDetails,
|
||||
change,
|
||||
sourceDetails?.aws?.account_id,
|
||||
]);
|
||||
|
||||
const onFormChange = ({ values }) => {
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ const ActivationKeys = ({ label, isRequired, ...props }) => {
|
|||
change('subscription-server-url', 'subscription.rhsm.stage.redhat.com');
|
||||
change('subscription-base-url', 'https://cdn.stage.redhat.com/');
|
||||
}
|
||||
}, []);
|
||||
}, [isProd, change]);
|
||||
|
||||
const setActivationKey = (_, selection) => {
|
||||
selectActivationKey(selection);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,13 @@ const AzureSourcesSelect = ({ label, isRequired, className, ...props }) => {
|
|||
if (isFetchingDetails || !isSuccessDetails) return;
|
||||
change('azure-tenant-id', sourceDetails?.azure?.tenant_id);
|
||||
change('azure-subscription-id', sourceDetails?.azure?.subscription_id);
|
||||
}, [isFetchingDetails, isSuccessDetails]);
|
||||
}, [
|
||||
isFetchingDetails,
|
||||
isSuccessDetails,
|
||||
sourceDetails?.azure?.subscription_id,
|
||||
sourceDetails?.azure?.tenant_id,
|
||||
change,
|
||||
]);
|
||||
|
||||
const onFormChange = ({ values }) => {
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ const FileSystemConfigButtons = ({ handleNext, handlePrev, nextStep }) => {
|
|||
);
|
||||
const [nextHasBeenClicked, setNextHasBeenClicked] = useState(false);
|
||||
const prefetchArchitectures = imageBuilderApi.usePrefetch('getArchitectures');
|
||||
const errors = getState()?.errors?.['file-system-configuration'];
|
||||
|
||||
useEffect(() => {
|
||||
const errors = getState()?.errors?.['file-system-configuration'];
|
||||
errors ? setHasErrors(true) : setHasErrors(false);
|
||||
|
||||
if (!errors) {
|
||||
setNextHasBeenClicked(false);
|
||||
change('file-system-config-show-errors', false);
|
||||
}
|
||||
});
|
||||
}, [errors, change]);
|
||||
|
||||
const handleClick = () => {
|
||||
if (!hasErrors) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ const FileSystemConfiguration = ({ ...props }) => {
|
|||
setItemOrder(newRows.map((row) => row.id));
|
||||
change('file-system-config-radio', 'manual');
|
||||
}
|
||||
}, [customizations, isSuccess]);
|
||||
}, [customizations, isSuccess, change, hasCustomizations, rows]);
|
||||
|
||||
useEffect(() => {
|
||||
const fsc = getState()?.values?.['file-system-configuration'];
|
||||
|
|
@ -123,7 +123,7 @@ const FileSystemConfiguration = ({ ...props }) => {
|
|||
});
|
||||
setRows(newRows);
|
||||
setItemOrder(newOrder);
|
||||
}, []);
|
||||
}, [getState]);
|
||||
|
||||
const showErrors = () =>
|
||||
getState()?.values?.['file-system-config-show-errors'];
|
||||
|
|
@ -144,7 +144,7 @@ const FileSystemConfiguration = ({ ...props }) => {
|
|||
return null;
|
||||
})
|
||||
);
|
||||
}, [rows, itemOrder]);
|
||||
}, [rows, itemOrder, change, input.name]);
|
||||
|
||||
const addRow = () => {
|
||||
const id = uuidv4();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const MountPoint = ({ ...props }) => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [props.mountpoint]);
|
||||
|
||||
useEffect(() => {
|
||||
let suf = suffix;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue