Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

refactor: updated loading state in gridgraphlayout (#3313)

Rajat Dabade1fc0461c0f41
diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx
index ee75c509f0..f363e02356 100644
--- a/frontend/src/container/GridGraphLayout/Graph/index.tsx
+++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx
@@ -101,7 +101,7 @@ function GridCardGraph({
const isEmptyLayout = widget?.id === 'empty' || isEmpty(widget);
- if (queryResponse.isRefetching) {
+ if (queryResponse.isRefetching || queryResponse.isLoading) {
return <Spinner height="20vh" tip="Loading..." />;
}
@@ -127,27 +127,23 @@ function GridCardGraph({
);
}
- if (queryResponse.status === 'loading' || queryResponse.status === 'idle') {
+ if (!isEmpty(widget) && prevChartDataSetRef?.labels) {
return (
<span ref={graphRef}>
- {!isEmpty(widget) && prevChartDataSetRef?.labels ? (
- <WidgetGraphComponent
- enableModel={false}
- enableWidgetHeader
- widget={widget}
- queryResponse={queryResponse}
- errorMessage={errorMessage}
- data={prevChartDataSetRef}
- name={name}
- yAxisUnit={yAxisUnit}
- layout={layout}
- setLayout={setLayout}
- headerMenuList={headerMenuList}
- onClickHandler={onClickHandler}
- />
- ) : (
- <Spinner height="20vh" tip="Loading..." />
- )}
+ <WidgetGraphComponent
+ enableModel={false}
+ enableWidgetHeader
+ widget={widget}
+ queryResponse={queryResponse}
+ errorMessage={errorMessage}
+ data={prevChartDataSetRef}
+ name={name}
+ yAxisUnit={yAxisUnit}
+ layout={layout}
+ setLayout={setLayout}
+ headerMenuList={headerMenuList}
+ onClickHandler={onClickHandler}
+ />
</span>
);
}