From 2bb6a1465c3b2fbd7a316e9a9b372ecfdf361490 Mon Sep 17 00:00:00 2001 From: Aarush-wadhia Date: Mon, 16 Sep 2024 17:16:55 +0530 Subject: [PATCH] fix(Featured agents): Featured agents when thrown error is handled and we can still navigate and see the other agents segment --- web/src/routes/+page.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 39253d4..1168849 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -55,16 +55,22 @@ }) ]); - const existingAgents = await existingResponse.json(); - const newAgents = await newResponse.json(); + let existingAgents = await existingResponse.json(); + let newAgents = await newResponse.json(); + debugger if (!existingResponse.ok && !newResponse.ok) { throw new Error("Failed to fetch agents"); } + if (!newResponse.ok) { + newAgents = []; + } + agents = existingAgents; filteredAgents = existingAgents; + debugger; // Combine agents from new API into sections sections = newAgents;