diff --git a/frontend/src/concepts/pipelines/apiHooks/useAllPipelineVersions.ts b/frontend/src/concepts/pipelines/apiHooks/useAllPipelineVersions.ts index 3a6552e747..977bc0d700 100644 --- a/frontend/src/concepts/pipelines/apiHooks/useAllPipelineVersions.ts +++ b/frontend/src/concepts/pipelines/apiHooks/useAllPipelineVersions.ts @@ -15,14 +15,14 @@ export const useAllPipelineVersions = ( refreshRate = 0, ): FetchState> => { const { api } = usePipelinesAPI(); - const [{ items: pipelines }] = usePipelines(); + const [{ items: pipelines }, pipelinesLoaded] = usePipelines(); const pipelineIds = useDeepCompareMemoize(pipelines.map((pipeline) => pipeline.id)); return usePipelineQuery( React.useCallback( async (opts, params) => { - if (pipelineIds.length === 0) { - return Promise.reject(new NotReadyError('No pipeline id')); + if (!pipelinesLoaded) { + return Promise.reject(new NotReadyError('Pipelines not loaded')); } const pipelineVersionRequests = pipelineIds.map((pipelineId) => @@ -42,7 +42,7 @@ export const useAllPipelineVersions = ( { total_size: 0, items: [] }, ); }, - [api, pipelineIds], + [api, pipelineIds, pipelinesLoaded], ), options, refreshRate,