Skip to content

Commit

Permalink
fix(webapp) avoid broken request when no experimentid (#710)
Browse files Browse the repository at this point in the history
experimentId is not present at page load and the app
will try to fetch from a wrong url (missing id)

Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com>
  • Loading branch information
prmths128 and inimaz authored Nov 15, 2024
1 parent 77af546 commit 11fb65d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion webapp/src/components/runs-scatter-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ async function getRunEmissionsByExperiment(
startDate: string,
endDate: string,
): Promise<RunReport[]> {
const url = `${process.env.NEXT_PUBLIC_API_URL}/experiments/${experimentId}/runs/sums?start_date=${startDate}&end_date=${endDate}`;
if (!experimentId || experimentId == "") {
return [];
}

const url = `${process.env.NEXT_PUBLIC_API_URL}/experiments/${experimentId}/runs/sums?start_date=${startDate}&end_date=${endDate}`;
const res = await fetch(url);

if (!res.ok) {
Expand Down

0 comments on commit 11fb65d

Please sign in to comment.