Fix endless loop

Signed-off-by: Jonathan Mezach <jonathan.mezach@rr-wfm.com>
This commit is contained in:
Jonathan Mezach
2023-04-18 10:40:04 +02:00
parent 26d2e605fb
commit 2f18f97f98
2 changed files with 14 additions and 10 deletions
@@ -28,11 +28,11 @@ export const EntityPageOctopusDeploy = (props: { defaultLimit?: number }) => {
const projectId = getProjectIdAnnotationFromEntity(entity);
const spaceId = getSpaceIdAnnotationFromEntity(entity);
const { environments, releases, loading, error } = useReleases({
const { environments, releases, loading, error } = useReleases(
projectId,
props.defaultLimit ?? 3,
spaceId,
releaseHistoryCount: props.defaultLimit ?? 3,
});
);
return (
<ReleaseTable
@@ -21,11 +21,11 @@ import {
OctopusReleaseProgression,
} from '../api';
export function useReleases(opts: {
projectId: string;
spaceId?: string;
releaseHistoryCount: number;
}): {
export function useReleases(
projectId: string,
releaseHistoryCount: number,
spaceId?: string,
): {
environments?: OctopusEnvironment[];
releases?: OctopusReleaseProgression[];
loading: boolean;
@@ -34,8 +34,12 @@ export function useReleases(opts: {
const api = useApi(octopusDeployApiRef);
const { value, loading, error } = useAsync(() => {
return api.getReleaseProgression(opts);
}, [api, opts]);
return api.getReleaseProgression({
projectId,
spaceId,
releaseHistoryCount,
});
}, [api, projectId, spaceId, releaseHistoryCount]);
return {
environments: value?.Environments,