Skip to content
Snippets Groups Projects
Commit e6e32061 authored by Zoltan Runyo's avatar Zoltan Runyo
Browse files

ICSWHI-7509: Fix React warning

parent 583aefe8
No related branches found
No related tags found
1 merge request!43ICSHWI-7509
Pipeline #87158 passed
......@@ -4,6 +4,8 @@ import { useDeploymentJob } from '../../api/SwaggerApi';
export function DeploymentJobOutput({ awxJobId, update }) {
const [deploymentJob, getDeploymentJob] = useDeploymentJob(awxJobId);
const stdoutRef = useRef(null);
const [firstTime, setFirstTime] = useState(true);
useEffect(() => {
const interval = setInterval(() => {
......@@ -15,12 +17,6 @@ export function DeploymentJobOutput({ awxJobId, update }) {
}, [update, getDeploymentJob]);
useEffect(() => {
scrollDown();
}, [deploymentJob]);
const stdoutRef = useRef(null);
const [firstTime, setFirstTime] = useState(true);
function scrollDown() {
if (stdoutRef.current) {
stdoutRef.current.scrollTop = stdoutRef.current.scrollHeight;
......@@ -31,6 +27,9 @@ export function DeploymentJobOutput({ awxJobId, update }) {
}
}
scrollDown();
}, [deploymentJob, firstTime]);
return deploymentJob?.job.started ?
<div
ref={stdoutRef}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment