mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
Don't build redirect until data available
This commit is contained in:
@@ -18,8 +18,11 @@ function JobTypeRedirect({ id, path, view, i18n }) {
|
|||||||
request: loadJob,
|
request: loadJob,
|
||||||
} = useRequest(
|
} = useRequest(
|
||||||
useCallback(async () => {
|
useCallback(async () => {
|
||||||
const { data } = await UnifiedJobsAPI.read({ id });
|
const {
|
||||||
return { job: data };
|
data: { results },
|
||||||
|
} = await UnifiedJobsAPI.read({ id });
|
||||||
|
const [item] = results;
|
||||||
|
return { job: item };
|
||||||
}, [id]),
|
}, [id]),
|
||||||
{ job: {} }
|
{ job: {} }
|
||||||
);
|
);
|
||||||
@@ -42,7 +45,7 @@ function JobTypeRedirect({ id, path, view, i18n }) {
|
|||||||
</PageSection>
|
</PageSection>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isLoading) {
|
if (isLoading || !job?.id) {
|
||||||
// TODO show loading state
|
// TODO show loading state
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user