Skip to content

Commit

Permalink
fix(reacthooks): Fix React Hooks linter errors
Browse files Browse the repository at this point in the history
Left the warnings to be dealt with/ignored later
  • Loading branch information
christopherthielen authored and mergify[bot] committed Mar 12, 2020
1 parent 98c7caf commit b347120
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export function ManualExecutionBakeManifest(props: ITriggerTemplateComponentProp
props.updateCommand('extraFields.artifacts', updatedArtifacts);
};

React.useEffect(() => {
if (overrideArtifact === false) {
removeHelmArtifact();
} else {
updateHelmArtifact(defaultArtifact);
}
}, [overrideArtifact]);

/*
Only allow manual override of a helm chart artifact when there is exactly one Helm
Bake (Manifest) stage and exactly one artifact of type `helm/chart`.
Expand All @@ -51,14 +59,6 @@ export function ManualExecutionBakeManifest(props: ITriggerTemplateComponentProp
version: null,
};

React.useEffect(() => {
if (overrideArtifact === false) {
removeHelmArtifact();
} else {
updateHelmArtifact(defaultArtifact);
}
}, [overrideArtifact]);

return (
<>
<div className="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { traverseObject } from 'core/utils';
* Use this component like you would use the <Formik/> component
*/
function SpinFormikImpl<Values extends {}>(props: FormikConfig<Values>, ref?: React.MutableRefObject<Formik<Values>>) {
const formikRef = ref || React.useRef<Formik<Values>>();
const defaultRef = React.useRef<Formik<Values>>();
const formikRef = ref || defaultRef;
const [refSaved, setRefSaved] = React.useState(false);
const [ready, setReady] = React.useState(false);

Expand Down
13 changes: 3 additions & 10 deletions app/scripts/modules/core/src/task/monitor/TaskMonitorWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,14 @@ export interface ITaskMonitorProps {
}

export const TaskMonitorWrapper = ({ monitor }: ITaskMonitorProps) => {
if (!monitor) {
return null;
}

const forceUpdate = useForceUpdate();
if (!monitor) {
return null;
}

useEffect(() => {
const subscription = monitor.statusUpdatedStream.subscribe(() => forceUpdate());
return () => subscription.unsubscribe();
const subscription = monitor?.statusUpdatedStream.subscribe(() => forceUpdate());
return () => subscription?.unsubscribe();
}, []);

if (!monitor.submitting && !monitor.error) {
if (!monitor || (!monitor.submitting && !monitor.error)) {
return null;
}

Expand Down

0 comments on commit b347120

Please sign in to comment.