Skip to content

Commit

Permalink
fix linting warnings
Browse files Browse the repository at this point in the history
fix some useEffect changes
  • Loading branch information
mgold1234 committed Jan 7, 2024
1 parent 4763024 commit dc5bd06
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
8 changes: 3 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React from 'react';

import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
import NotificationsPortal from '@redhat-cloud-services/frontend-components-notifications/NotificationPortal';
Expand All @@ -11,10 +11,8 @@ const App = (props) => {
const store = useStore();
const { hideGlobalFilter, updateDocumentTitle } = useChrome();

useEffect(() => {
updateDocumentTitle('Image Builder | Red Hat Insights');
hideGlobalFilter();
}, []);
updateDocumentTitle('Image Builder | Red Hat Insights');
hideGlobalFilter();

return (
<React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -123,7 +123,7 @@ const FileSystemConfiguration = ({ ...props }) => {
});
setRows(newRows);
setItemOrder(newOrder);
}, []);
}, [getState]);

const showErrors = () =>
getState()?.values?.['file-system-config-show-errors'];
Expand All @@ -143,7 +143,7 @@ const FileSystemConfiguration = ({ ...props }) => {
}
})
);
}, [rows, itemOrder]);
}, [rows, itemOrder, change, input.name]);

const addRow = () => {
const id = uuidv4();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MountPoint = ({ ...props }) => {
return;
}
}
}, []);
}, [props.mountpoint]);

useEffect(() => {
let suf = suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const Packages = ({ getAllPackages, isSuccess }) => {
}
setChosenPackages(newChosenPackages);
}
}, []);
}, [selectedPackages]);

useEffect(() => {
if (isSuccess) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ImagesTable/ClonesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';

import { ClipboardCopy, Skeleton } from '@patternfly/react-core';
import { ClipboardCopy } from '@patternfly/react-core';
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';

import { StatusClone, AwsDetailsStatus } from './Status';
Expand Down

0 comments on commit dc5bd06

Please sign in to comment.