From 1a1146b0bc985da39020fba8df1e51418c19af41 Mon Sep 17 00:00:00 2001 From: ktx-kirtan <124270523+ktx-kirtan@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:53:29 +0530 Subject: [PATCH] fix: reset the data when there are no queries to execute (#2491) - Resets the chart rendering when there are no queries, fixes the alert preview chart when switching from the SQL to promql --- web/src/composables/dashboard/usePanelDataLoader.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/composables/dashboard/usePanelDataLoader.ts b/web/src/composables/dashboard/usePanelDataLoader.ts index 2c4f61dbcf..8195217c87 100644 --- a/web/src/composables/dashboard/usePanelDataLoader.ts +++ b/web/src/composables/dashboard/usePanelDataLoader.ts @@ -31,7 +31,11 @@ export const usePanelDataLoader = ( variablesData: any, chartPanelRef: any ) => { - const log = (...args: any[]) => {}; + const log = (...args: any[]) => { + // if (true) { + // console.log(panelSchema?.value?.title + ": ", ...args); + // } + }; const state = reactive({ data: [] as any, @@ -157,6 +161,10 @@ export const usePanelDataLoader = ( // Checking if there are queries to execute if (!panelSchema.value.queries?.length || !hasAtLeastOneQuery()) { + log("loadData: there are no queries to execute"); + state.loading = false; + state.data = []; + state.metadata = {} return; }