Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/hooks/use-data-source-stats

lib/hooks/use-data-source-stats

React Query hook for fetching data source statistics.

Provides event counts per catalog and dataset for display in the DataSourceSelector component. Data is cached with a long stale time since total counts don’t change frequently.

Variables

dataSourceStatsQueryKey

const dataSourceStatsQueryKey: readonly ["data-source-stats"]

Query key for data source stats.

Functions

useDataSourceStatsQuery()

useDataSourceStatsQuery(): UseQueryResult<DataSourceStatsResponse, Error>

Hook to fetch event counts by catalog and dataset.

Returns total event counts for each catalog and dataset. These counts are independent of any filters and represent the total available data in each source.

Returns

UseQueryResult<DataSourceStatsResponse, Error>

Example

const { data: stats } = useDataSourceStatsQuery(); // Access counts const catalogEventCount = stats?.catalogCounts["1"] ?? 0; const datasetEventCount = stats?.datasetCounts["5"] ?? 0;

References

DataSourceStatsResponse

Re-exports DataSourceStatsResponse

Last updated on