Skip to content

Commit

Permalink
Do not call projects/params endpoint if no experiment is selected (G-…
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiovincenzi authored and vinayan3 committed Aug 28, 2024
1 parent 051d41e commit d890342
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/src/services/api/projects/projectsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ function getProjectParams(
sequences: string[] = ['metric'],
selectedExperimentNames: string[] = [],
): IApiRequest<IProjectParamsMetrics> {
if (selectedExperimentNames.length === 0) {
const controller = new AbortController();
return {
call: () =>
new Promise((resolve: (data: IProjectParamsMetrics) => any) => {
// Simulating an empty response
const data: IProjectParamsMetrics = {
metric: {},
images: {},
params: {},
};
resolve(data);
}),
abort: () => controller.abort(),
};
}
const query =
sequences.reduce((acc: string, sequence: string, index: number) => {
acc += `${index === 0 ? '?' : '&'}sequence=${sequence}`;
Expand Down

0 comments on commit d890342

Please sign in to comment.