From eeb1c576b9983cc9c9d350a2d4bd0f00521208fa Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 8 Apr 2025 09:38:14 -0600 Subject: [PATCH] filter out undefined query params --- web/src/api/buster_rest/dashboards/queryServerRequests.ts | 4 +++- web/src/api/createServerInstance.ts | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/api/buster_rest/dashboards/queryServerRequests.ts b/web/src/api/buster_rest/dashboards/queryServerRequests.ts index 1773c6786..b6978dfaa 100644 --- a/web/src/api/buster_rest/dashboards/queryServerRequests.ts +++ b/web/src/api/buster_rest/dashboards/queryServerRequests.ts @@ -10,7 +10,9 @@ export const prefetchGetDashboard = async ( await queryClient.prefetchQuery({ ...dashboardQueryKeys.dashboardGetDashboard(params.id, params.version_number), - queryFn: () => getDashboard_server(params) + queryFn: async () => { + return await getDashboard_server(params); + } }); return queryClient; diff --git a/web/src/api/createServerInstance.ts b/web/src/api/createServerInstance.ts index 64b9ba99d..10848f93e 100644 --- a/web/src/api/createServerInstance.ts +++ b/web/src/api/createServerInstance.ts @@ -20,7 +20,13 @@ export const serverFetch = async (url: string, config: FetchConfig = {}): Pro // Construct URL with query parameters const queryParams = params - ? `?${new URLSearchParams(Object.fromEntries(Object.entries(params).map(([k, v]) => [k, String(v)])))}` + ? `?${new URLSearchParams( + Object.fromEntries( + Object.entries(params) + .filter(([_, v]) => v !== undefined) + .map(([k, v]) => [k, String(v)]) + ) + )}` : ''; const fullUrl = `${baseURL}${url}${queryParams}`;