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.

658 B
Raw Blame
import { useMemo } from 'react';
import { type DashboardSection, layoutsToSections } from '../utils';
import { useDashboardFetchRequired } from './useDashboardFetchRequired';

/**
 * The current dashboard's sections, derived from the guaranteed-loaded dashboard
 * via useDashboardFetchRequired. That reuses the shared react-query cache (no extra
 * request) instead of prop-drilling the section list.
 */
export function useDashboardSections(): DashboardSection[] {
	const { dashboard } = useDashboardFetchRequired();
	const spec = dashboard.spec;

	return useMemo(
		() => layoutsToSections(spec.layouts, spec.panels),
		[spec.layouts, spec.panels],
	);
}